Completed
Push — develop ( f3c189...e92436 )
by Alejandro
08:55
created

MailEvent::setResult()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 5
ccs 3
cts 3
cp 1
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
crap 1
1
<?php
2
namespace AcMailer\Event;
3
4
use AcMailer\Result\ResultAwareInterface;
5
use AcMailer\Result\ResultInterface;
6
use AcMailer\Service\MailServiceInterface;
7
use Zend\EventManager\Event;
8
9
/**
10
 * Encapsulation of a Mail event
11
 * @author Alejandro Celaya Alastrué
12
 * @link http://www.alejandrocelaya.com
13
 */
14
class MailEvent extends Event implements ResultAwareInterface
15
{
16
    const EVENT_MAIL_PRE_SEND   = 'event.mail.pre.send';
17
    const EVENT_MAIL_POST_SEND  = 'event.mail.post.send';
18
    const EVENT_MAIL_SEND_ERROR = 'event.mail.send.error';
19
20
    /**
21
     * @var MailServiceInterface
22
     */
23
    protected $mailService;
24
    /**
25
     * @var ResultInterface
26
     */
27
    protected $result;
28
29 11
    public function __construct(MailServiceInterface $mailService, $name = self::EVENT_MAIL_PRE_SEND)
30
    {
31 11
        parent::__construct($name);
32 11
        $this->mailService = $mailService;
33 11
    }
34
35
    /**
36
     * @param $mailService
37
     * @return $this
38
     */
39 1
    public function setMailService($mailService)
40
    {
41 1
        $this->mailService = $mailService;
42 1
        return $this;
43
    }
44
    /**
45
     * @return \AcMailer\Service\MailServiceInterface
46
     */
47 1
    public function getMailService()
48
    {
49 1
        return $this->mailService;
50
    }
51
52
    /**
53
     * @param ResultInterface $result
54
     * @return $this
55
     */
56 10
    public function setResult(ResultInterface $result)
57
    {
58 10
        $this->result = $result;
59 10
        return $this;
60
    }
61
62
    /**
63
     * @return ResultInterface
64
     */
65 1
    public function getResult()
66
    {
67 1
        return $this->result;
68
    }
69
}
70