MailEvent::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 9
ccs 7
cts 7
cp 1
rs 9.9666
c 0
b 0
f 0
cc 1
nc 1
nop 5
crap 1
1
<?php
2
3
/*
4
 * This file is part of the 2amigos/yii2-usuario project.
5
 *
6
 * (c) 2amigOS! <http://2amigos.us/>
7
 *
8
 * For the full copyright and license information, please view
9
 * the LICENSE file that was distributed with this source code.
10
 */
11
12
namespace Da\User\Event;
13
14
use Da\User\Model\User;
15
use Da\User\Service\MailService;
16
use yii\base\Event;
17
18
/**
19
 * @property-read string $type
20
 * @property-read User $user
21
 * @property-read MailService $mailService
22
 * @property-read mixed|\Exception $exception
23
 */
24
class MailEvent extends Event
25
{
26
    const TYPE_WELCOME = 'welcome';
27
    const TYPE_RECOVERY = 'recovery';
28
    const TYPE_CONFIRM = 'confirm';
29
    const TYPE_RECONFIRM = 'reconfirm';
30
31
    const EVENT_BEFORE_SEND_MAIL = 'beforeSendMail';
32
    const EVENT_AFTER_SEND_MAIL = 'afterSendMail';
33
34
    protected $type;
35
    protected $user;
36
    protected $mailService;
37
    protected $exception;
38
39 9
    public function __construct($type, User $user, MailService $mailService, $exception, $config = [])
40
    {
41 9
        $this->type = $type;
42 9
        $this->user = $user;
43 9
        $this->mailService = $mailService;
44 9
        $this->exception = $exception;
45
46 9
        parent::__construct($config);
47 9
    }
48
49
    public function getType()
50
    {
51
        return $this->type;
52
    }
53
54
    public function getUser()
55
    {
56
        return $this->user;
57
    }
58
59
    public function getMailService()
60
    {
61
        return $this->mailService;
62
    }
63
64
    public function getException()
65
    {
66
        return $this->exception;
67
    }
68
}
69