@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | $this->xUploadHandler = $this->di->getUploadHandler(); |
109 | 109 | |
110 | 110 | // Return true if the request plugin was already found |
111 | - if($this->xRequestPlugin !== null) |
|
111 | + if ($this->xRequestPlugin !== null) |
|
112 | 112 | { |
113 | 113 | return true; |
114 | 114 | } |
@@ -116,9 +116,9 @@ discard block |
||
116 | 116 | // The HTTP request |
117 | 117 | $xRequest = $this->di->getRequest(); |
118 | 118 | // Find a plugin to process the request |
119 | - foreach($this->xPluginManager->getRequestHandlers() as $sClassName) |
|
119 | + foreach ($this->xPluginManager->getRequestHandlers() as $sClassName) |
|
120 | 120 | { |
121 | - if($sClassName::canProcessRequest($xRequest)) |
|
121 | + if ($sClassName::canProcessRequest($xRequest)) |
|
122 | 122 | { |
123 | 123 | $this->xRequestPlugin = $this->di->g($sClassName); |
124 | 124 | $this->xRequestPlugin->setTarget($xRequest); |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | } |
128 | 128 | |
129 | 129 | // Check if the upload plugin is enabled |
130 | - if($this->xUploadHandler === null) |
|
130 | + if ($this->xUploadHandler === null) |
|
131 | 131 | { |
132 | 132 | return false; |
133 | 133 | } |
@@ -149,15 +149,15 @@ discard block |
||
149 | 149 | // The HTTP request |
150 | 150 | $xRequest = $this->di->getRequest(); |
151 | 151 | // Process uploaded files, if the upload plugin is enabled |
152 | - if($this->xUploadHandler !== null && $this->xUploadHandler->canProcessRequest($xRequest)) |
|
152 | + if ($this->xUploadHandler !== null && $this->xUploadHandler->canProcessRequest($xRequest)) |
|
153 | 153 | { |
154 | 154 | $this->xUploadHandler->processRequest($xRequest); |
155 | 155 | } |
156 | 156 | // Process the request |
157 | - if(($this->xRequestPlugin)) |
|
157 | + if (($this->xRequestPlugin)) |
|
158 | 158 | { |
159 | 159 | $xResponse = $this->xRequestPlugin->processRequest(); |
160 | - if(($xResponse)) |
|
160 | + if (($xResponse)) |
|
161 | 161 | { |
162 | 162 | $this->xResponseManager->append($xResponse); |
163 | 163 | } |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | public function processRequest() |
179 | 179 | { |
180 | 180 | // Check if there is a plugin to process this request |
181 | - if(!$this->canProcessRequest()) |
|
181 | + if (!$this->canProcessRequest()) |
|
182 | 182 | { |
183 | 183 | return; |
184 | 184 | } |
@@ -187,11 +187,11 @@ discard block |
||
187 | 187 | { |
188 | 188 | $bEndRequest = false; |
189 | 189 | // Handle before processing event |
190 | - if(($this->xRequestPlugin)) |
|
190 | + if (($this->xRequestPlugin)) |
|
191 | 191 | { |
192 | 192 | $this->xCallbackManager->onBefore($this->xRequestPlugin->getTarget(), $bEndRequest); |
193 | 193 | } |
194 | - if($bEndRequest) |
|
194 | + if ($bEndRequest) |
|
195 | 195 | { |
196 | 196 | return; |
197 | 197 | } |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | $this->_processRequest(); |
200 | 200 | |
201 | 201 | // Handle after processing event |
202 | - if(($this->xRequestPlugin)) |
|
202 | + if (($this->xRequestPlugin)) |
|
203 | 203 | { |
204 | 204 | $this->xCallbackManager->onAfter($this->xRequestPlugin->getTarget(), $bEndRequest); |
205 | 205 | } |
@@ -207,12 +207,12 @@ discard block |
||
207 | 207 | // An exception was thrown while processing the request. |
208 | 208 | // The request missed the corresponding handler function, |
209 | 209 | // or an error occurred while attempting to execute the handler. |
210 | - catch(RequestException $e) |
|
210 | + catch (RequestException $e) |
|
211 | 211 | { |
212 | 212 | $this->xResponseManager->error($e->getMessage()); |
213 | 213 | $this->xCallbackManager->onInvalid($e); |
214 | 214 | } |
215 | - catch(Exception $e) |
|
215 | + catch (Exception $e) |
|
216 | 216 | { |
217 | 217 | $this->xResponseManager->error($e->getMessage()); |
218 | 218 | $this->xCallbackManager->onError($e); |
@@ -211,8 +211,7 @@ |
||
211 | 211 | { |
212 | 212 | $this->xResponseManager->error($e->getMessage()); |
213 | 213 | $this->xCallbackManager->onInvalid($e); |
214 | - } |
|
215 | - catch(Exception $e) |
|
214 | + } catch(Exception $e) |
|
216 | 215 | { |
217 | 216 | $this->xResponseManager->error($e->getMessage()); |
218 | 217 | $this->xCallbackManager->onError($e); |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | */ |
100 | 100 | public function popBootCallbacks(): array |
101 | 101 | { |
102 | - if(empty($this->aBootCallbacks)) |
|
102 | + if (empty($this->aBootCallbacks)) |
|
103 | 103 | { |
104 | 104 | return []; |
105 | 105 | } |
@@ -118,9 +118,9 @@ discard block |
||
118 | 118 | private function getExceptionCallbacks(Exception $xException): array |
119 | 119 | { |
120 | 120 | $aExceptionCallbacks = []; |
121 | - foreach($this->aExceptionCallbacks as $sExClass => $aCallbacks) |
|
121 | + foreach ($this->aExceptionCallbacks as $sExClass => $aCallbacks) |
|
122 | 122 | { |
123 | - if(is_a($xException, $sExClass)) |
|
123 | + if (is_a($xException, $sExClass)) |
|
124 | 124 | { |
125 | 125 | $aExceptionCallbacks = array_merge($aExceptionCallbacks, $aCallbacks); |
126 | 126 | } |
@@ -190,13 +190,13 @@ discard block |
||
190 | 190 | */ |
191 | 191 | public function error(callable $xCallable, string $sExClass = ''): CallbackManager |
192 | 192 | { |
193 | - if($sExClass === '' || $sExClass === Exception::class) |
|
193 | + if ($sExClass === '' || $sExClass === Exception::class) |
|
194 | 194 | { |
195 | 195 | $this->aErrorCallbacks[] = $xCallable; |
196 | 196 | return $this; |
197 | 197 | } |
198 | 198 | // Callback for a given exception class |
199 | - if(isset($this->aExceptionCallbacks[$sExClass])) |
|
199 | + if (isset($this->aExceptionCallbacks[$sExClass])) |
|
200 | 200 | { |
201 | 201 | $this->aExceptionCallbacks[$sExClass][] = $xCallable; |
202 | 202 | return $this; |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | private function executeCallback(callable $xCallback, array $aParameters) |
228 | 228 | { |
229 | 229 | $xReturn = call_user_func_array($xCallback, $aParameters); |
230 | - if($xReturn instanceof ResponseInterface) |
|
230 | + if ($xReturn instanceof ResponseInterface) |
|
231 | 231 | { |
232 | 232 | $this->xResponseManager->append($xReturn); |
233 | 233 | } |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | */ |
242 | 242 | private function executeCallbacks(array $aCallbacks, array $aParameters) |
243 | 243 | { |
244 | - foreach($aCallbacks as $xCallback) |
|
244 | + foreach ($aCallbacks as $xCallback) |
|
245 | 245 | { |
246 | 246 | $this->executeCallback($xCallback, $aParameters); |
247 | 247 | } |
@@ -271,10 +271,10 @@ discard block |
||
271 | 271 | public function onBefore(Target $xTarget, bool &$bEndRequest) |
272 | 272 | { |
273 | 273 | // Call the user defined callback |
274 | - foreach($this->aBeforeCallbacks as $xCallback) |
|
274 | + foreach ($this->aBeforeCallbacks as $xCallback) |
|
275 | 275 | { |
276 | 276 | $this->executeCallback($xCallback, [$xTarget, &$bEndRequest]); |
277 | - if($bEndRequest) |
|
277 | + if ($bEndRequest) |
|
278 | 278 | { |
279 | 279 | return; |
280 | 280 | } |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | { |
322 | 322 | $aExceptionCallbacks = $this->getExceptionCallbacks($xException); |
323 | 323 | $this->executeCallbacks($aExceptionCallbacks, [$xException]); |
324 | - if(count($aExceptionCallbacks) > 0) |
|
324 | + if (count($aExceptionCallbacks) > 0) |
|
325 | 325 | { |
326 | 326 | // Do not throw the exception if a custom handler is defined |
327 | 327 | return; |