Completed
Pull Request — master (#66)
by Eric
34:27
created

DomainEvent::getMessage()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
/*
4
 * This file is part of the Lug package.
5
 *
6
 * (c) Eric GELOEN <[email protected]>
7
 *
8
 * For the full copyright and license information, please read the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Lug\Component\Resource\Domain;
13
14
use Lug\Component\Resource\Model\ResourceInterface;
15
use Symfony\Component\EventDispatcher\Event;
16
17
/**
18
 * @author GeLo <[email protected]>
19
 */
20
class DomainEvent extends Event
21
{
22
    /**
23
     * @var ResourceInterface
24
     */
25
    private $resource;
26
27
    /**
28
     * @var string
29
     */
30
    private $action;
31
32
    /**
33
     * @var mixed
34
     */
35
    private $data;
36
37
    /**
38
     * @var int|null
39
     */
40
    private $statusCode;
41
42
    /**
43
     * @var string|null
44
     */
45
    private $messageType;
46
47
    /**
48
     * @var string|null
49
     */
50
    private $message;
51
52
    /**
53
     * @var bool
54
     */
55
    private $stopped = false;
56
57
    /**
58
     * @param ResourceInterface $resource
59
     * @param string            $action
60
     * @param mixed             $data
61
     */
62 26
    public function __construct(ResourceInterface $resource, $action, $data = null)
63
    {
64 26
        $this->resource = $resource;
65 26
        $this->action = $action;
66 26
        $this->data = $data;
67 26
    }
68
69
    /**
70
     * @return ResourceInterface
71
     */
72 21
    public function getResource()
73
    {
74 21
        return $this->resource;
75
    }
76
77
    /**
78
     * @return string
79
     */
80 21
    public function getAction()
81
    {
82 21
        return $this->action;
83
    }
84
85
    /**
86
     * @return mixed
87
     */
88 21
    public function getData()
89
    {
90 21
        return $this->data;
91
    }
92
93
    /**
94
     * @param mixed $data
95
     */
96 10
    public function setData($data)
97
    {
98 10
        $this->data = $data;
99
    }
100
101
    /**
102
     * @return int
103
     */
104 6
    public function getStatusCode()
105
    {
106 6
        return $this->statusCode;
107 6
    }
108
109
    /**
110
     * @param int $statusCode
111
     */
112 2
    public function setStatusCode($statusCode)
113
    {
114 2
        $this->statusCode = $statusCode;
115
    }
116
117
    /**
118
     * @return string
119
     */
120 1
    public function getMessageType()
121
    {
122 1
        return $this->messageType;
123 1
    }
124
125
    /**
126
     * @param string $messageType
127
     */
128 10
    public function setMessageType($messageType)
129
    {
130 10
        $this->messageType = $messageType;
131
    }
132
133
    /**
134
     * @return string
135
     */
136 6
    public function getMessage()
137
    {
138 6
        return $this->message;
139 6
    }
140
141
    /**
142
     * @param string $message
143
     */
144 22
    public function setMessage($message)
145
    {
146 22
        $this->message = $message;
147
    }
148
149
    /**
150
     * @return bool
151
     */
152 11
    public function isStopped()
153
    {
154 11
        return $this->stopped;
155 11
    }
156
157
    /**
158
     * @param bool $stopped
159
     */
160
    public function setStopped($stopped)
161
    {
162
        $this->stopped = $stopped;
163
    }
164
}
165