MailEvent   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 46.67%

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 1
dl 0
loc 45
ccs 7
cts 15
cp 0.4667
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 1
A getType() 0 4 1
A getUser() 0 4 1
A getMailService() 0 4 1
A getException() 0 4 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