1 | <?php |
||
43 | abstract class AbstractMiddleware implements MiddlewareInterface, DataPreProcessorInterface |
||
44 | { |
||
45 | /** |
||
46 | * @var MiddlewareState |
||
47 | */ |
||
48 | private $state; |
||
49 | |||
50 | /** |
||
51 | * @var \Romm\Formz\Middleware\Option\DefaultOptionDefinition |
||
52 | */ |
||
53 | protected $options; |
||
54 | |||
55 | /** |
||
56 | * @param AbstractOptionDefinition $options |
||
57 | */ |
||
58 | final public function __construct(AbstractOptionDefinition $options) |
||
62 | |||
63 | /** |
||
64 | * Abstraction for processing the middleware initialization. |
||
65 | * |
||
66 | * For own initialization, @see initializeMiddleware() |
||
67 | */ |
||
68 | final public function initialize() |
||
72 | |||
73 | /** |
||
74 | * You can override this method in your child class to initialize your |
||
75 | * middleware correctly. |
||
76 | */ |
||
77 | protected function initializeMiddleware() |
||
80 | |||
81 | /** |
||
82 | * @see \Romm\Formz\Middleware\Signal\SendsMiddlewareSignal::beforeSignal() |
||
83 | * |
||
84 | * @param string $signal |
||
85 | * @return SignalObject |
||
86 | */ |
||
87 | final public function beforeSignal($signal = null) |
||
91 | |||
92 | /** |
||
93 | * @see \Romm\Formz\Middleware\Signal\SendsMiddlewareSignal::afterSignal() |
||
94 | * |
||
95 | * @param string $signal |
||
96 | * @return SignalObject |
||
97 | */ |
||
98 | final public function afterSignal($signal = null) |
||
102 | |||
103 | /** |
||
104 | * Returns a new forward dispatcher, on which you can add options by calling |
||
105 | * its fluent methods. |
||
106 | * |
||
107 | * You must call the method `dispatch()` to actually dispatch the forward |
||
108 | * signal. |
||
109 | * |
||
110 | * @return Forward |
||
111 | */ |
||
112 | final protected function forward() |
||
116 | |||
117 | /** |
||
118 | * Returns a new redirect dispatcher, on which you can add options by |
||
119 | * calling its fluent methods. |
||
120 | * |
||
121 | * You must call the method `dispatch()` to actually dispatch the redirect |
||
122 | * signal. |
||
123 | * |
||
124 | * @return Redirect |
||
125 | */ |
||
126 | final protected function redirect() { |
||
129 | |||
130 | /** |
||
131 | * Will stop the propagation of middlewares: the next middlewares wont be |
||
132 | * processed. |
||
133 | * |
||
134 | * Use with caution! |
||
135 | */ |
||
136 | final protected function stopPropagation() |
||
140 | |||
141 | /** |
||
142 | * @return FormObject |
||
143 | */ |
||
144 | final protected function getFormObject() |
||
148 | |||
149 | /** |
||
150 | * @return FormResult |
||
151 | */ |
||
152 | final protected function getResult() |
||
156 | |||
157 | /** |
||
158 | * @return Request |
||
159 | */ |
||
160 | final protected function getRequest() |
||
164 | |||
165 | /** |
||
166 | * @return Arguments |
||
167 | */ |
||
168 | final protected function getRequestArguments() |
||
172 | |||
173 | /** |
||
174 | * @return array |
||
175 | */ |
||
176 | final protected function getSettings() |
||
180 | |||
181 | /** |
||
182 | * @return int |
||
183 | */ |
||
184 | public function getPriority() |
||
188 | |||
189 | /** |
||
190 | * @param MiddlewareState $middlewareState |
||
191 | */ |
||
192 | final public function bindMiddlewareState(MiddlewareState $middlewareState) |
||
196 | |||
197 | /** |
||
198 | * Returns the name of the signal on which this middleware is bound. |
||
199 | * |
||
200 | * @return string |
||
201 | * @throws SignalNotFoundException |
||
202 | */ |
||
203 | final public function getBoundSignalName() |
||
215 | |||
216 | /** |
||
217 | * Will inject empty options if no option has been defined at all. |
||
218 | * |
||
219 | * @param DataPreProcessor $processor |
||
220 | */ |
||
221 | public static function dataPreProcessor(DataPreProcessor $processor) |
||
231 | |||
232 | /** |
||
233 | * @param string $signal |
||
234 | * @param string $type |
||
235 | * @return SignalObject |
||
236 | * @throws InvalidArgumentValueException |
||
237 | * @throws InvalidEntryException |
||
238 | * @throws MissingArgumentException |
||
239 | */ |
||
240 | private function getSignalObject($signal, $type) |
||
261 | } |
||
262 |
Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a given class or a super-class is assigned to a property that is type hinted more strictly.
Either this assignment is in error or an instanceof check should be added for that assignment.