1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the smsmode-bundle package. |
5
|
|
|
* |
6
|
|
|
* (c) 2019 WEBEWEB |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace WBW\Bundle\SMSModeBundle\Event; |
13
|
|
|
|
14
|
|
|
use WBW\Bundle\CoreBundle\Event\AbstractEvent as BaseEvent; |
15
|
|
|
use WBW\Library\SMSMode\Entity\SMSModeEntityInterface; |
16
|
|
|
use WBW\Library\SMSMode\Model\AbstractRequest; |
17
|
|
|
use WBW\Library\SMSMode\Model\AbstractResponse; |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* Abstract event. |
21
|
|
|
* |
22
|
|
|
* @author webeweb <https://github.com/webeweb/> |
23
|
|
|
* @package WBW\Bundle\SMSModeBundle\Event |
24
|
|
|
* @abstract |
25
|
|
|
*/ |
26
|
|
|
abstract class AbstractEvent extends BaseEvent { |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* Entity. |
30
|
|
|
* |
31
|
|
|
* @var SMSModeEntityInterface |
32
|
|
|
*/ |
33
|
|
|
private $entity; |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* Request. |
37
|
|
|
* |
38
|
|
|
* @var AbstractRequest |
39
|
|
|
*/ |
40
|
|
|
private $request; |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* Response. |
44
|
|
|
* |
45
|
|
|
* @var AbstractResponse |
46
|
|
|
*/ |
47
|
|
|
private $response; |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* Constructor. |
51
|
|
|
* |
52
|
|
|
* @param string $eventName The event name. |
53
|
|
|
* @param SMSModeEntityInterface|null $entity The entity. |
54
|
|
|
*/ |
55
|
|
|
protected function __construct($eventName, SMSModeEntityInterface $entity = null) { |
56
|
|
|
parent::__construct($eventName); |
57
|
|
|
$this->setEntity($entity); |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* Get the entity. |
62
|
|
|
* |
63
|
|
|
* @return SMSModeEntityInterface Returns the entity. |
64
|
|
|
*/ |
65
|
|
|
protected function getEntity() { |
66
|
|
|
return $this->entity; |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
/** |
70
|
|
|
* Get the request. |
71
|
|
|
* |
72
|
|
|
* @return AbstractRequest Returns the request. |
73
|
|
|
*/ |
74
|
|
|
protected function getRequest() { |
75
|
|
|
return $this->request; |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
/** |
79
|
|
|
* Get the response. |
80
|
|
|
* |
81
|
|
|
* @return AbstractResponse Returns the response. |
82
|
|
|
*/ |
83
|
|
|
protected function getResponse() { |
84
|
|
|
return $this->response; |
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
/** |
88
|
|
|
* Set the entity. |
89
|
|
|
* |
90
|
|
|
* @param SMSModeEntityInterface|null $entity The entity. |
91
|
|
|
* @return AbstractEvent Returns this sMsmode event. |
92
|
|
|
*/ |
93
|
|
|
protected function setEntity(SMSModeEntityInterface $entity = null) { |
94
|
|
|
$this->entity = $entity; |
95
|
|
|
return $this; |
96
|
|
|
} |
97
|
|
|
|
98
|
|
|
/** |
99
|
|
|
* Set the request. |
100
|
|
|
* |
101
|
|
|
* @param AbstractRequest $request The request. |
102
|
|
|
* @return AbstractEvent Returns this sMsmode event. |
103
|
|
|
*/ |
104
|
|
|
public function setRequest(AbstractRequest $request) { |
105
|
|
|
$this->request = $request; |
106
|
|
|
return $this; |
107
|
|
|
} |
108
|
|
|
|
109
|
|
|
/** |
110
|
|
|
* Set the response. |
111
|
|
|
* |
112
|
|
|
* @param AbstractResponse $response The response. |
113
|
|
|
* @return AbstractEvent Returns this sMsmode event. |
114
|
|
|
*/ |
115
|
|
|
public function setResponse(AbstractResponse $response) { |
116
|
|
|
$this->response = $response; |
117
|
|
|
return $this; |
118
|
|
|
} |
119
|
|
|
} |
120
|
|
|
|