MailEvent::getEmail()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

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