Failed Conditions
Pull Request — master (#48)
by Rafael
05:06
created

EmailTrait::sendWebhookEmail()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 7
nc 1
nop 2
dl 0
loc 9
ccs 0
cts 9
cp 0
crap 2
rs 10
c 0
b 0
f 0
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