Passed
Pull Request — master (#48)
by Rafael
05:04
created

EmailTrait   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 17
ccs 0
cts 9
cp 0
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A sendWebhookEmail() 0 9 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Gewaer\Traits;
6
7
use Gewaer\Models\Users;
8
use Phalcon\Di;
9
10
/**
11
 * Trait EmailTrait
12
 *
13
 * @package Gewaer\Traits
14
 *
15
 * @property Users $user
16
 * @property AppsPlans $appPlan
17
 * @property CompanyBranches $branches
18
 * @property Companies $company
19
 * @property UserCompanyApps $app
20
 * @property \Phalcon\Di $di
21
 *
22
 */
23
trait EmailTrait
24
{
25
    /**
26
     * Send webhook related emails to user
27
     * @param string $email
28
     * @param array $template
29
     * @return void
30
     */
31
    public static function sendWebhookEmail(string $email, array $template): void
32
    {
33
        $subject = $template['subject'];
34
        $content = $template['content'];
35
        Di::getDefault()->getMail()
36
            ->to($email)
37
            ->subject($subject)
38
            ->content($content)
39
            ->sendNow();
40
    }
41
}
42