1 | <?php |
||
20 | class ResourceControllerEvent extends GenericEvent |
||
21 | { |
||
22 | const TYPE_ERROR = 'error'; |
||
23 | const TYPE_WARNING = 'warning'; |
||
24 | const TYPE_INFO = 'info'; |
||
25 | const TYPE_SUCCESS = 'success'; |
||
26 | |||
27 | /** |
||
28 | * @var string |
||
29 | */ |
||
30 | private $messageType = ''; |
||
31 | |||
32 | /** |
||
33 | * @var string |
||
34 | */ |
||
35 | private $message = ''; |
||
36 | |||
37 | /** |
||
38 | * @var array |
||
39 | */ |
||
40 | private $messageParameters = []; |
||
41 | |||
42 | /** |
||
43 | * @var int |
||
44 | */ |
||
45 | private $errorCode = 500; |
||
46 | |||
47 | /** |
||
48 | * @var Response |
||
49 | */ |
||
50 | private $response; |
||
51 | |||
52 | /** |
||
53 | * @param string $message |
||
54 | * @param string $type |
||
55 | * @param array $parameters |
||
56 | * @param int $errorCode |
||
57 | */ |
||
58 | public function stop($message, $type = self::TYPE_ERROR, $parameters = [], $errorCode = 500) |
||
67 | |||
68 | /** |
||
69 | * @return bool |
||
70 | */ |
||
71 | public function isStopped() |
||
75 | |||
76 | /** |
||
77 | * @return string |
||
78 | */ |
||
79 | public function getMessageType() |
||
83 | |||
84 | /** |
||
85 | * @param string $messageType Should be one of ResourceEvent's TYPE constants |
||
86 | */ |
||
87 | public function setMessageType($messageType) |
||
91 | |||
92 | /** |
||
93 | * @return string |
||
94 | */ |
||
95 | public function getMessage() |
||
99 | |||
100 | /** |
||
101 | * @param string $message |
||
102 | */ |
||
103 | public function setMessage($message) |
||
107 | |||
108 | /** |
||
109 | * @return array |
||
110 | */ |
||
111 | public function getMessageParameters() |
||
115 | |||
116 | /** |
||
117 | * @param array $messageParameters |
||
118 | */ |
||
119 | public function setMessageParameters(array $messageParameters) |
||
123 | |||
124 | /** |
||
125 | * @return int |
||
126 | */ |
||
127 | public function getErrorCode() |
||
131 | |||
132 | /** |
||
133 | * @param int $errorCode |
||
134 | */ |
||
135 | public function setErrorCode($errorCode) |
||
139 | |||
140 | /** |
||
141 | * @param Response $response |
||
142 | */ |
||
143 | public function setResponse(Response $response) |
||
147 | |||
148 | /** |
||
149 | * @return bool |
||
150 | */ |
||
151 | public function hasResponse() |
||
155 | |||
156 | /** |
||
157 | * @return Response |
||
158 | */ |
||
159 | public function getResponse() |
||
163 | } |
||
164 |