MailEvent   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 1
dl 0
loc 47
c 0
b 0
f 0
rs 10
ccs 12
cts 12
cp 1

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getEmail() 0 4 1
A setResult() 0 5 1
A getResult() 0 4 1
1
<?php
2
declare(strict_types=1);
3
4
namespace AcMailer\Event;
5
6
use AcMailer\Model\Email;
7
use AcMailer\Result\ResultAwareInterface;
8
use AcMailer\Result\ResultInterface;
9
use Zend\EventManager\Event;
10
11
/**
12
 * Encapsulation of a Mail event
13
 * @author Alejandro Celaya Alastrué
14
 * @link http://www.alejandrocelaya.com
15
 */
16
class MailEvent extends Event implements ResultAwareInterface
17
{
18
    const EVENT_MAIL_PRE_SEND   = 'event.mail.pre.send';
19
    const EVENT_MAIL_POST_SEND  = 'event.mail.post.send';
20
    const EVENT_MAIL_SEND_ERROR = 'event.mail.send.error';
21
22
    /**
23
     * @var ResultInterface
24
     */
25
    protected $result;
26
    /**
27
     * @var Email
28
     */
29 11
    private $email;
30
31 11
    public function __construct(Email $email, $name = self::EVENT_MAIL_PRE_SEND)
32 11
    {
33 11
        parent::__construct($name);
34
        $this->email = $email;
35
    }
36
37
    /**
38
     * @return Email
39 1
     */
40
    public function getEmail(): Email
41 1
    {
42 1
        return $this->email;
43
    }
44
45
    /**
46
     * @param ResultInterface $result
47 1
     * @return $this
48
     */
49 1
    public function setResult(ResultInterface $result)
50
    {
51
        $this->result = $result;
52
        return $this;
53
    }
54
55
    /**
56 10
     * @return ResultInterface|null
57
     */
58 10
    public function getResult()
59 10
    {
60
        return $this->result;
61
    }
62
}
63