Passed
Push — main ( 01ee0f...5fbd1e )
by Thierry
02:22
created
src/Request/Handler/Psr/PsrRequestHandler.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@
 block discarded – undo
72 72
         // and the other classes will get this request from there.
73 73
         $this->di->val(ServerRequestInterface::class, $request);
74 74
 
75
-        if(!$this->xRequestHandler->canProcessRequest())
75
+        if (!$this->xRequestHandler->canProcessRequest())
76 76
         {
77 77
             // Unable to find a plugin to process the request
78 78
             throw new RequestException($this->xTranslator->trans('errors.request.plugin'));
Please login to merge, or discard this patch.
src/Request/Handler/Psr/PsrAjaxMiddleware.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@
 block discarded – undo
64 64
         // and the other classes will get this request from there.
65 65
         $this->di->val(ServerRequestInterface::class, $request);
66 66
 
67
-        if(!$this->xRequestHandler->canProcessRequest())
67
+        if (!$this->xRequestHandler->canProcessRequest())
68 68
         {
69 69
             // Unable to find a plugin to process the request
70 70
             return $handler->handle($request);
Please login to merge, or discard this patch.
src/Request/Handler/CallbackManager.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@
 block discarded – undo
65 65
      */
66 66
     public function popBootCallbacks(): array
67 67
     {
68
-        if(empty($this->aBootCallbacks))
68
+        if (empty($this->aBootCallbacks))
69 69
         {
70 70
             return [];
71 71
         }
Please login to merge, or discard this patch.
src/Request/Handler/RequestHandler.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -300,8 +300,7 @@
 block discarded – undo
300 300
             $this->xResponseManager->error($e->getMessage());
301 301
             $this->onInvalid($e);
302 302
             throw $e;
303
-        }
304
-        catch(Exception $e)
303
+        } catch(Exception $e)
305 304
         {
306 305
             $this->xResponseManager->error($e->getMessage());
307 306
             $this->onError($e);
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -111,14 +111,14 @@  discard block
 block discarded – undo
111 111
     {
112 112
         $xTarget = $this->xRequestPlugin->getTarget();
113 113
         // Call the user defined callback
114
-        foreach($this->xCallbackManager->getBeforeCallbacks() as $xCallback)
114
+        foreach ($this->xCallbackManager->getBeforeCallbacks() as $xCallback)
115 115
         {
116 116
             $xReturn = call_user_func_array($xCallback, [$xTarget, &$bEndRequest]);
117
-            if($xReturn instanceof ResponseInterface)
117
+            if ($xReturn instanceof ResponseInterface)
118 118
             {
119 119
                 $this->xResponseManager->append($xReturn);
120 120
             }
121
-            if($bEndRequest)
121
+            if ($bEndRequest)
122 122
             {
123 123
                 return;
124 124
             }
@@ -133,11 +133,11 @@  discard block
 block discarded – undo
133 133
      */
134 134
     public function onAfter(bool $bEndRequest)
135 135
     {
136
-        foreach($this->xCallbackManager->getAfterCallbacks() as $xCallback)
136
+        foreach ($this->xCallbackManager->getAfterCallbacks() as $xCallback)
137 137
         {
138 138
             $xReturn = call_user_func_array($xCallback,
139 139
                 [$this->xRequestPlugin->getTarget(), $bEndRequest]);
140
-            if($xReturn instanceof ResponseInterface)
140
+            if ($xReturn instanceof ResponseInterface)
141 141
             {
142 142
                 $this->xResponseManager->append($xReturn);
143 143
             }
@@ -154,10 +154,10 @@  discard block
 block discarded – undo
154 154
      */
155 155
     public function onInvalid(RequestException $xException)
156 156
     {
157
-        foreach($this->xCallbackManager->getInvalidCallbacks() as $xCallback)
157
+        foreach ($this->xCallbackManager->getInvalidCallbacks() as $xCallback)
158 158
         {
159 159
             $xReturn = call_user_func($xCallback, $xException);
160
-            if($xReturn instanceof ResponseInterface)
160
+            if ($xReturn instanceof ResponseInterface)
161 161
             {
162 162
                 $this->xResponseManager->append($xReturn);
163 163
             }
@@ -174,10 +174,10 @@  discard block
 block discarded – undo
174 174
      */
175 175
     public function onError(Exception $xException)
176 176
     {
177
-        foreach($this->xCallbackManager->getErrorCallbacks() as $xCallback)
177
+        foreach ($this->xCallbackManager->getErrorCallbacks() as $xCallback)
178 178
         {
179 179
             $xReturn = call_user_func($xCallback, $xException);
180
-            if($xReturn instanceof ResponseInterface)
180
+            if ($xReturn instanceof ResponseInterface)
181 181
             {
182 182
                 $this->xResponseManager->append($xReturn);
183 183
             }
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
         $this->xUploadHandler = $this->di->getUploadHandler();
197 197
 
198 198
         // Return true if the request plugin was already found
199
-        if($this->xRequestPlugin !== null)
199
+        if ($this->xRequestPlugin !== null)
200 200
         {
201 201
             return true;
202 202
         }
@@ -204,9 +204,9 @@  discard block
 block discarded – undo
204 204
         // The HTTP request
205 205
         $xRequest = $this->di->getRequest();
206 206
         // Find a plugin to process the request
207
-        foreach($this->xPluginManager->getRequestHandlers() as $sClassName)
207
+        foreach ($this->xPluginManager->getRequestHandlers() as $sClassName)
208 208
         {
209
-            if($sClassName::canProcessRequest($xRequest))
209
+            if ($sClassName::canProcessRequest($xRequest))
210 210
             {
211 211
                 $this->xRequestPlugin = $this->di->g($sClassName);
212 212
                 $this->xRequestPlugin->setTarget($xRequest);
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
         }
216 216
 
217 217
         // Check if the upload plugin is enabled
218
-        if($this->xUploadHandler === null)
218
+        if ($this->xUploadHandler === null)
219 219
         {
220 220
             return false;
221 221
         }
@@ -237,15 +237,15 @@  discard block
 block discarded – undo
237 237
         // The HTTP request
238 238
         $xRequest = $this->di->getRequest();
239 239
         // Process uploaded files, if the upload plugin is enabled
240
-        if($this->xUploadHandler !== null && $this->xUploadHandler->canProcessRequest($xRequest))
240
+        if ($this->xUploadHandler !== null && $this->xUploadHandler->canProcessRequest($xRequest))
241 241
         {
242 242
             $this->xUploadHandler->processRequest($xRequest);
243 243
         }
244 244
         // Process the request
245
-        if(($this->xRequestPlugin))
245
+        if (($this->xRequestPlugin))
246 246
         {
247 247
             $xResponse = $this->xRequestPlugin->processRequest();
248
-            if(($xResponse))
248
+            if (($xResponse))
249 249
             {
250 250
                 $this->xResponseManager->append($xResponse);
251 251
             }
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
     public function processRequest()
267 267
     {
268 268
         // Check if there is a plugin to process this request
269
-        if(!$this->canProcessRequest())
269
+        if (!$this->canProcessRequest())
270 270
         {
271 271
             return;
272 272
         }
@@ -275,11 +275,11 @@  discard block
 block discarded – undo
275 275
         {
276 276
             $bEndRequest = false;
277 277
             // Handle before processing event
278
-            if(($this->xRequestPlugin))
278
+            if (($this->xRequestPlugin))
279 279
             {
280 280
                 $this->onBefore($bEndRequest);
281 281
             }
282
-            if($bEndRequest)
282
+            if ($bEndRequest)
283 283
             {
284 284
                 return;
285 285
             }
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
             $this->_processRequest();
288 288
 
289 289
             // Handle after processing event
290
-            if(($this->xRequestPlugin))
290
+            if (($this->xRequestPlugin))
291 291
             {
292 292
                 $this->onAfter($bEndRequest);
293 293
             }
@@ -295,13 +295,13 @@  discard block
 block discarded – undo
295 295
         // An exception was thrown while processing the request.
296 296
         // The request missed the corresponding handler function,
297 297
         // or an error occurred while attempting to execute the handler.
298
-        catch(RequestException $e)
298
+        catch (RequestException $e)
299 299
         {
300 300
             $this->xResponseManager->error($e->getMessage());
301 301
             $this->onInvalid($e);
302 302
             throw $e;
303 303
         }
304
-        catch(Exception $e)
304
+        catch (Exception $e)
305 305
         {
306 306
             $this->xResponseManager->error($e->getMessage());
307 307
             $this->onError($e);
Please login to merge, or discard this patch.
src/Request/Handler/ParameterReader.php 3 patches
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -110,8 +110,7 @@  discard block
 block discarded – undo
110 110
         if(isset($aServerParams['CONTENT_TYPE']))
111 111
         {
112 112
             $sContentType = $aServerParams['CONTENT_TYPE'];
113
-        }
114
-        elseif(isset($aServerParams['HTTP_CONTENT_TYPE']))
113
+        } elseif(isset($aServerParams['HTTP_CONTENT_TYPE']))
115 114
         {
116 115
             $sContentType = $aServerParams['HTTP_CONTENT_TYPE'];
117 116
         }
@@ -142,20 +141,17 @@  discard block
 block discarded – undo
142 141
             $this->cUtf8Decoder = function($sStr) use($sEncoding) {
143 142
                 return iconv("UTF-8", $sEncoding . '//TRANSLIT', $sStr);
144 143
             };
145
-        }
146
-        elseif(function_exists('mb_convert_encoding'))
144
+        } elseif(function_exists('mb_convert_encoding'))
147 145
         {
148 146
             $this->cUtf8Decoder = function($sStr) use($sEncoding) {
149 147
                 return mb_convert_encoding($sStr, $sEncoding, "UTF-8");
150 148
             };
151
-        }
152
-        elseif($sEncoding === "ISO-8859-1")
149
+        } elseif($sEncoding === "ISO-8859-1")
153 150
         {
154 151
             $this->cUtf8Decoder = function($sStr) {
155 152
                 return utf8_decode($sStr);
156 153
             };
157
-        }
158
-        else
154
+        } else
159 155
         {
160 156
             throw new RequestException($this->xTranslator->trans('errors.request.conversion'));
161 157
         }
@@ -251,8 +247,7 @@  discard block
 block discarded – undo
251 247
             {
252 248
                 $aParams = $aBody['jxnargs'];
253 249
             }
254
-        }
255
-        else
250
+        } else
256 251
         {
257 252
             $aParams = $xRequest->getQueryParams();
258 253
             if(isset($aParams['jxnargs']))
Please login to merge, or discard this patch.
Switch Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -196,15 +196,15 @@
 block discarded – undo
196 196
         $sValue = substr($sValue, 1);
197 197
         switch($cType)
198 198
         {
199
-        case 'S':
200
-            return $sValue;
201
-        case 'B':
202
-            return $this->convertStringToBool($sValue);
203
-        case 'N':
204
-            return ($sValue == floor($sValue) ? (int)$sValue : (float)$sValue);
205
-        case '*':
206
-        default:
207
-            return null;
199
+            case 'S':
200
+                return $sValue;
201
+            case 'B':
202
+                return $this->convertStringToBool($sValue);
203
+            case 'N':
204
+                return ($sValue == floor($sValue) ? (int)$sValue : (float)$sValue);
205
+            case '*':
206
+            default:
207
+                return null;
208 208
         }
209 209
     }
210 210
 
Please login to merge, or discard this patch.
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -107,16 +107,16 @@  discard block
 block discarded – undo
107 107
         // Parameters are url encoded when uploading files
108 108
         $aServerParams = $this->di->getRequest()->getServerParams();
109 109
         $sContentType = '';
110
-        if(isset($aServerParams['CONTENT_TYPE']))
110
+        if (isset($aServerParams['CONTENT_TYPE']))
111 111
         {
112 112
             $sContentType = $aServerParams['CONTENT_TYPE'];
113 113
         }
114
-        elseif(isset($aServerParams['HTTP_CONTENT_TYPE']))
114
+        elseif (isset($aServerParams['HTTP_CONTENT_TYPE']))
115 115
         {
116 116
             $sContentType = $aServerParams['HTTP_CONTENT_TYPE'];
117 117
         }
118 118
         $sType = 'multipart/form-data';
119
-        if(strncmp($sContentType, $sType, strlen($sType)) !== 0)
119
+        if (strncmp($sContentType, $sType, strlen($sType)) !== 0)
120 120
         {
121 121
             $this->cParamDecoder = function($sParam) { return $sParam; };
122 122
             return;
@@ -137,19 +137,19 @@  discard block
 block discarded – undo
137 137
             return $sStr;
138 138
         };
139 139
         $sEncoding = $this->xConfigManager->getOption('core.encoding', '');
140
-        if(function_exists('iconv'))
140
+        if (function_exists('iconv'))
141 141
         {
142 142
             $this->cUtf8Decoder = function($sStr) use($sEncoding) {
143 143
                 return iconv("UTF-8", $sEncoding . '//TRANSLIT', $sStr);
144 144
             };
145 145
         }
146
-        elseif(function_exists('mb_convert_encoding'))
146
+        elseif (function_exists('mb_convert_encoding'))
147 147
         {
148 148
             $this->cUtf8Decoder = function($sStr) use($sEncoding) {
149 149
                 return mb_convert_encoding($sStr, $sEncoding, "UTF-8");
150 150
             };
151 151
         }
152
-        elseif($sEncoding === "ISO-8859-1")
152
+        elseif ($sEncoding === "ISO-8859-1")
153 153
         {
154 154
             $this->cUtf8Decoder = function($sStr) {
155 155
                 return utf8_decode($sStr);
@@ -170,11 +170,11 @@  discard block
 block discarded – undo
170 170
      */
171 171
     private function convertStringToBool(string $sValue): bool
172 172
     {
173
-        if(strcasecmp($sValue, 'true') === 0)
173
+        if (strcasecmp($sValue, 'true') === 0)
174 174
         {
175 175
             return true;
176 176
         }
177
-        if(strcasecmp($sValue, 'false') === 0)
177
+        if (strcasecmp($sValue, 'false') === 0)
178 178
         {
179 179
             return false;
180 180
         }
@@ -194,14 +194,14 @@  discard block
 block discarded – undo
194 194
     {
195 195
         $cType = substr($sValue, 0, 1);
196 196
         $sValue = substr($sValue, 1);
197
-        switch($cType)
197
+        switch ($cType)
198 198
         {
199 199
         case 'S':
200 200
             return $sValue;
201 201
         case 'B':
202 202
             return $this->convertStringToBool($sValue);
203 203
         case 'N':
204
-            return ($sValue == floor($sValue) ? (int)$sValue : (float)$sValue);
204
+            return ($sValue == floor($sValue) ? (int) $sValue : (float) $sValue);
205 205
         case '*':
206 206
         default:
207 207
             return null;
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
      */
218 218
     private function decodeRequestParameter(string $sParam)
219 219
     {
220
-        if($sParam === '')
220
+        if ($sParam === '')
221 221
         {
222 222
             return $sParam;
223 223
         }
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
         $sParam = call_user_func($this->cParamDecoder, $sParam);
226 226
 
227 227
         $xJson = json_decode($sParam, true);
228
-        if($xJson !== null && $sParam != $xJson)
228
+        if ($xJson !== null && $sParam != $xJson)
229 229
         {
230 230
             return $xJson;
231 231
         }
@@ -240,9 +240,9 @@  discard block
 block discarded – undo
240 240
         $aParams = [];
241 241
         $xRequest = $this->di->getRequest();
242 242
         $aBody = $xRequest->getParsedBody();
243
-        if(is_array($aBody))
243
+        if (is_array($aBody))
244 244
         {
245
-            if(isset($aBody['jxnargs']))
245
+            if (isset($aBody['jxnargs']))
246 246
             {
247 247
                 $aParams = $aBody['jxnargs'];
248 248
             }
@@ -250,13 +250,13 @@  discard block
 block discarded – undo
250 250
         else
251 251
         {
252 252
             $aParams = $xRequest->getQueryParams();
253
-            if(isset($aParams['jxnargs']))
253
+            if (isset($aParams['jxnargs']))
254 254
             {
255 255
                 $aParams = $aParams['jxnargs'];
256 256
             }
257 257
         }
258 258
         return array_map(function($sParam) {
259
-            return $this->decodeRequestParameter((string)$sParam);
259
+            return $this->decodeRequestParameter((string) $sParam);
260 260
         }, $aParams);
261 261
     }
262 262
 
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
      */
270 270
     private function decodeUtf8Parameter($xValue)
271 271
     {
272
-        if(is_string($xValue))
272
+        if (is_string($xValue))
273 273
         {
274 274
             return call_user_func($this->cUtf8Decoder, $xValue);
275 275
         }
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
     private function decodeUtf8Parameters(array $aParams): array
290 290
     {
291 291
         $aValues = [];
292
-        foreach($aParams as $sKey => $xValue)
292
+        foreach ($aParams as $sKey => $xValue)
293 293
         {
294 294
             // Decode the key
295 295
             $sKey = call_user_func($this->cUtf8Decoder, $sKey);
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
     {
311 311
         $this->setParamDecoder();
312 312
         $aParams = $this->getRequestParameters();
313
-        if(!$this->xConfigManager->getOption('core.decode_utf8'))
313
+        if (!$this->xConfigManager->getOption('core.decode_utf8'))
314 314
         {
315 315
             return $aParams;
316 316
         }
Please login to merge, or discard this patch.
src/Plugin/Request/CallableFunction/CallableFunctionPlugin.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -125,8 +125,7 @@
 block discarded – undo
125 125
         if(is_string($xOptions))
126 126
         {
127 127
             $xOptions = ['include' => $xOptions];
128
-        }
129
-        elseif(!is_array($xOptions))
128
+        } elseif(!is_array($xOptions))
130 129
         {
131 130
             throw new SetupException($this->xTranslator->trans('errors.objects.invalid-declaration'));
132 131
         }
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -128,15 +128,15 @@  discard block
 block discarded – undo
128 128
      */
129 129
     public function checkOptions(string $sCallable, $xOptions): array
130 130
     {
131
-        if(!$this->xValidator->validateFunction(trim($sCallable)))
131
+        if (!$this->xValidator->validateFunction(trim($sCallable)))
132 132
         {
133 133
             throw new SetupException($this->xTranslator->trans('errors.objects.invalid-declaration'));
134 134
         }
135
-        if(is_string($xOptions))
135
+        if (is_string($xOptions))
136 136
         {
137 137
             $xOptions = ['include' => $xOptions];
138 138
         }
139
-        elseif(!is_array($xOptions))
139
+        elseif (!is_array($xOptions))
140 140
         {
141 141
             throw new SetupException($this->xTranslator->trans('errors.objects.invalid-declaration'));
142 142
         }
@@ -157,9 +157,9 @@  discard block
 block discarded – undo
157 157
         $sPhpFunction = trim($sCallable);
158 158
         $sFunction = $sPhpFunction;
159 159
         // Check if an alias is defined
160
-        if(isset($aOptions['alias']))
160
+        if (isset($aOptions['alias']))
161 161
         {
162
-            $sFunction = (string)$aOptions['alias'];
162
+            $sFunction = (string) $aOptions['alias'];
163 163
             unset($aOptions['alias']);
164 164
         }
165 165
         $this->aFunctions[$sFunction] = $sPhpFunction;
@@ -181,13 +181,13 @@  discard block
 block discarded – undo
181 181
     public function getCallable(string $sCallable)
182 182
     {
183 183
         $sFunction = trim($sCallable);
184
-        if(!isset($this->aFunctions[$sFunction]))
184
+        if (!isset($this->aFunctions[$sFunction]))
185 185
         {
186 186
             return null;
187 187
         }
188 188
         $xCallable = new CallableFunction($this->di, $sFunction,
189 189
             $this->sPrefix . $sFunction, $this->aFunctions[$sFunction]);
190
-        foreach($this->aOptions[$sFunction] as $sName => $sValue)
190
+        foreach ($this->aOptions[$sFunction] as $sName => $sValue)
191 191
         {
192 192
             $xCallable->configure($sName, $sValue);
193 193
         }
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
     public function getScript(): string
217 217
     {
218 218
         $code = '';
219
-        foreach(array_keys($this->aFunctions) as $sFunction)
219
+        foreach (array_keys($this->aFunctions) as $sFunction)
220 220
         {
221 221
             $xFunction = $this->getCallable($sFunction);
222 222
             $code .= $this->getCallableScript($xFunction);
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
     public static function canProcessRequest(ServerRequestInterface $xRequest): bool
231 231
     {
232 232
         $aBody = $xRequest->getParsedBody();
233
-        if(is_array($aBody))
233
+        if (is_array($aBody))
234 234
         {
235 235
             return isset($aBody['jxnfun']);
236 236
         }
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
     public function setTarget(ServerRequestInterface $xRequest)
245 245
     {
246 246
         $aBody = $xRequest->getParsedBody();
247
-        if(is_array($aBody))
247
+        if (is_array($aBody))
248 248
         {
249 249
             $this->xTarget = Target::makeFunction(trim($aBody['jxnfun']));
250 250
             return;
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
         $sRequestedFunction = $this->xTarget->getFunctionName();
263 263
 
264 264
         // Security check: make sure the requested function was registered.
265
-        if(!$this->xValidator->validateFunction($sRequestedFunction) ||
265
+        if (!$this->xValidator->validateFunction($sRequestedFunction) ||
266 266
             !isset($this->aFunctions[$sRequestedFunction]))
267 267
         {
268 268
             // Unable to find the requested function
Please login to merge, or discard this patch.
src/Plugin/Request/CallableFunction/CallableFunction.php 2 patches
Switch Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -114,15 +114,15 @@
 block discarded – undo
114 114
     {
115 115
         switch($sName)
116 116
         {
117
-        case 'class': // The user function is a method in the given class
118
-            $this->xPhpFunction = [$sValue, $this->xPhpFunction];
119
-            break;
120
-        case 'include':
121
-            $this->sInclude = $sValue;
122
-            break;
123
-        default:
124
-            $this->aOptions[$sName] = $sValue;
125
-            break;
117
+            case 'class': // The user function is a method in the given class
118
+                $this->xPhpFunction = [$sValue, $this->xPhpFunction];
119
+                break;
120
+            case 'include':
121
+                $this->sInclude = $sValue;
122
+                break;
123
+            default:
124
+                $this->aOptions[$sName] = $sValue;
125
+                break;
126 126
         }
127 127
     }
128 128
 
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
      */
124 124
     public function configure(string $sName, string $sValue)
125 125
     {
126
-        switch($sName)
126
+        switch ($sName)
127 127
         {
128 128
         case 'class': // The user function is a method in the given class
129 129
             $this->xPhpFunction = [$sValue, $this->xPhpFunction];
@@ -147,12 +147,12 @@  discard block
 block discarded – undo
147 147
      */
148 148
     public function call(array $aArgs = [])
149 149
     {
150
-        if(($this->sInclude))
150
+        if (($this->sInclude))
151 151
         {
152 152
             require_once $this->sInclude;
153 153
         }
154 154
         // If the function is an alias for a class method, then instantiate the class
155
-        if(is_array($this->xPhpFunction) && is_string($this->xPhpFunction[0]))
155
+        if (is_array($this->xPhpFunction) && is_string($this->xPhpFunction[0]))
156 156
         {
157 157
             $sClassName = $this->xPhpFunction[0];
158 158
             $this->xPhpFunction[0] = $this->di->h($sClassName) ?
Please login to merge, or discard this patch.
src/Plugin/Request/CallableDir/CallableDirPlugin.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
     private function checkDirectory(string $sDirectory): string
81 81
     {
82 82
         $sDirectory = rtrim(trim($sDirectory), '/\\');
83
-        if(!is_dir($sDirectory))
83
+        if (!is_dir($sDirectory))
84 84
         {
85 85
             throw new SetupException($this->xTranslator->trans('errors.objects.invalid-declaration'));
86 86
         }
@@ -93,11 +93,11 @@  discard block
 block discarded – undo
93 93
      */
94 94
     public function checkOptions(string $sCallable, $xOptions): array
95 95
     {
96
-        if(is_string($xOptions))
96
+        if (is_string($xOptions))
97 97
         {
98 98
             $xOptions = ['namespace' => $xOptions];
99 99
         }
100
-        if(!is_array($xOptions))
100
+        if (!is_array($xOptions))
101 101
         {
102 102
             throw new SetupException($this->xTranslator->trans('errors.objects.invalid-declaration'));
103 103
         }
@@ -105,14 +105,14 @@  discard block
 block discarded – undo
105 105
         $xOptions['directory'] = $this->checkDirectory($sCallable);
106 106
         // Check the namespace
107 107
         $sNamespace = $xOptions['namespace'] ?? '';
108
-        if(!($xOptions['namespace'] = trim($sNamespace, ' \\')))
108
+        if (!($xOptions['namespace'] = trim($sNamespace, ' \\')))
109 109
         {
110 110
             $xOptions['namespace'] = '';
111 111
         }
112 112
 
113 113
         // Change the keys in $xOptions to have "\" as separator
114 114
         $_aOptions = [];
115
-        foreach($xOptions as $sName => $aOption)
115
+        foreach ($xOptions as $sName => $aOption)
116 116
         {
117 117
             $sName = trim(str_replace('.', '\\', $sName), ' \\');
118 118
             $_aOptions[$sName] = $aOption;
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
      */
126 126
     public function register(string $sType, string $sCallable, array $aOptions): bool
127 127
     {
128
-        if(($aOptions['namespace']))
128
+        if (($aOptions['namespace']))
129 129
         {
130 130
             $this->xRegistry->addNamespace($aOptions['namespace'], $aOptions);
131 131
             return true;
Please login to merge, or discard this patch.
src/Plugin/Request/CallableClass/CallableObject.php 3 patches
Switch Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -207,36 +207,36 @@
 block discarded – undo
207 207
         switch($sName)
208 208
         {
209 209
         // Set the separator
210
-        case 'separator':
211
-            if($xValue === '_' || $xValue === '.')
212
-            {
213
-                $this->sSeparator = $xValue;
214
-            }
215
-            break;
216
-        // Set the protected methods
217
-        case 'protected':
218
-            if(is_array($xValue))
219
-            {
220
-                $this->aProtectedMethods = array_merge($this->aProtectedMethods, $xValue);
221
-            }
222
-            break;
223
-        // Set the methods to call before processing the request
224
-        case '__before':
225
-            $this->setHookMethods($this->aBeforeMethods, $xValue);
226
-            break;
227
-        // Set the methods to call after processing the request
228
-        case '__after':
229
-            $this->setHookMethods($this->aAfterMethods, $xValue);
230
-            break;
231
-        // Set the attributes to inject in the callable object
232
-        case '__di':
233
-            $this->aAttributes = array_merge($this->aAttributes, $xValue);
234
-            break;
235
-        case 'excluded':
236
-            $this->bExcluded = (bool)$xValue;
237
-            break;
238
-        default:
239
-            break;
210
+            case 'separator':
211
+                if($xValue === '_' || $xValue === '.')
212
+                {
213
+                    $this->sSeparator = $xValue;
214
+                }
215
+                break;
216
+            // Set the protected methods
217
+            case 'protected':
218
+                if(is_array($xValue))
219
+                {
220
+                    $this->aProtectedMethods = array_merge($this->aProtectedMethods, $xValue);
221
+                }
222
+                break;
223
+            // Set the methods to call before processing the request
224
+            case '__before':
225
+                $this->setHookMethods($this->aBeforeMethods, $xValue);
226
+                break;
227
+            // Set the methods to call after processing the request
228
+            case '__after':
229
+                $this->setHookMethods($this->aAfterMethods, $xValue);
230
+                break;
231
+            // Set the attributes to inject in the callable object
232
+            case '__di':
233
+                $this->aAttributes = array_merge($this->aAttributes, $xValue);
234
+                break;
235
+            case 'excluded':
236
+                $this->bExcluded = (bool)$xValue;
237
+                break;
238
+            default:
239
+                break;
240 240
         }
241 241
     }
242 242
 
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -186,8 +186,7 @@
 block discarded – undo
186 186
             if(is_array($xMethodToCall))
187 187
             {
188 188
                 $aHookMethods[$sCalledMethod] = $xMethodToCall;
189
-            }
190
-            elseif(is_string($xMethodToCall))
189
+            } elseif(is_string($xMethodToCall))
191 190
             {
192 191
                 $aHookMethods[$sCalledMethod] = [$xMethodToCall];
193 192
             }
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -193,13 +193,13 @@  discard block
 block discarded – undo
193 193
      */
194 194
     private function setHookMethods(array &$aHookMethods, $xValue)
195 195
     {
196
-        foreach($xValue as $sCalledMethod => $xMethodToCall)
196
+        foreach ($xValue as $sCalledMethod => $xMethodToCall)
197 197
         {
198
-            if(is_array($xMethodToCall))
198
+            if (is_array($xMethodToCall))
199 199
             {
200 200
                 $aHookMethods[$sCalledMethod] = $xMethodToCall;
201 201
             }
202
-            elseif(is_string($xMethodToCall))
202
+            elseif (is_string($xMethodToCall))
203 203
             {
204 204
                 $aHookMethods[$sCalledMethod] = [$xMethodToCall];
205 205
             }
@@ -216,18 +216,18 @@  discard block
 block discarded – undo
216 216
      */
217 217
     public function configure(string $sName, $xValue)
218 218
     {
219
-        switch($sName)
219
+        switch ($sName)
220 220
         {
221 221
         // Set the separator
222 222
         case 'separator':
223
-            if($xValue === '_' || $xValue === '.')
223
+            if ($xValue === '_' || $xValue === '.')
224 224
             {
225 225
                 $this->sSeparator = $xValue;
226 226
             }
227 227
             break;
228 228
         // Set the protected methods
229 229
         case 'protected':
230
-            if(is_array($xValue))
230
+            if (is_array($xValue))
231 231
             {
232 232
                 $this->aProtectedMethods = array_merge($this->aProtectedMethods, $xValue);
233 233
             }
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
             $this->aAttributes = array_merge($this->aAttributes, $xValue);
246 246
             break;
247 247
         case 'excluded':
248
-            $this->bExcluded = (bool)$xValue;
248
+            $this->bExcluded = (bool) $xValue;
249 249
             break;
250 250
         default:
251 251
             break;
@@ -295,16 +295,16 @@  discard block
 block discarded – undo
295 295
      */
296 296
     private function getOptionValue(array $aCommonOptions, array $aMethodOptions, string $sOptionName)
297 297
     {
298
-        if(!isset($aCommonOptions[$sOptionName]))
298
+        if (!isset($aCommonOptions[$sOptionName]))
299 299
         {
300 300
             return $aMethodOptions[$sOptionName];
301 301
         }
302
-        if(!isset($aMethodOptions[$sOptionName]))
302
+        if (!isset($aMethodOptions[$sOptionName]))
303 303
         {
304 304
             return $aCommonOptions[$sOptionName];
305 305
         }
306 306
         // If both are not arrays, return the latest.
307
-        if(!is_array($aCommonOptions[$sOptionName]) && !is_array($aMethodOptions[$sOptionName]))
307
+        if (!is_array($aCommonOptions[$sOptionName]) && !is_array($aMethodOptions[$sOptionName]))
308 308
         {
309 309
             return $aMethodOptions[$sOptionName];
310 310
         }
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
         $aMethodOptions = isset($this->aOptions[$sMethodName]) ? $this->aOptions[$sMethodName] : [];
329 329
         $aOptionNames = array_unique(array_merge(array_keys($aCommonOptions), array_keys($aMethodOptions)));
330 330
         $aOptions = [];
331
-        foreach($aOptionNames as $sOptionName)
331
+        foreach ($aOptionNames as $sOptionName)
332 332
         {
333 333
             $aOptions[$sOptionName] = $this->getOptionValue($aCommonOptions, $aMethodOptions, $sOptionName);
334 334
         }
@@ -412,11 +412,11 @@  discard block
 block discarded – undo
412 412
         // $aMethods = $aHookMethods[$sMethod] ?? $aHookMethods['*'] ?? [];
413 413
         // The hooks defined at method level are merged with those defined at class level.
414 414
         $aMethods = array_merge($aHookMethods['*'] ?? [], $aHookMethods[$sMethod] ?? []);
415
-        foreach($aMethods as $xKey => $xValue)
415
+        foreach ($aMethods as $xKey => $xValue)
416 416
         {
417 417
             $sHookName = $xValue;
418 418
             $aHookArgs = [];
419
-            if(is_string($xKey))
419
+            if (is_string($xKey))
420 420
             {
421 421
                 $sHookName = $xKey;
422 422
                 $aHookArgs = is_array($xValue) ? $xValue : [$xValue];
@@ -457,7 +457,7 @@  discard block
 block discarded – undo
457 457
         // $aAttributes = $this->aAttributes[$sMethod] ?? $this->aAttributes['*'] ?? [];
458 458
         // The attributes defined at method level are merged with those defined at class level.
459 459
         $aAttributes = array_merge($this->aAttributes['*'] ?? [], $this->aAttributes[$sMethod] ?? []);
460
-        foreach($aAttributes as $sName => $sClass)
460
+        foreach ($aAttributes as $sName => $sClass)
461 461
         {
462 462
             // Set the protected attributes of the object
463 463
             $cSetter = function($c) use($sName, $sClass) {
@@ -469,7 +469,7 @@  discard block
 block discarded – undo
469 469
         }
470 470
 
471 471
         // Set the Jaxon request target in the helper
472
-        if($this->xRegisteredObject instanceof CallableClass)
472
+        if ($this->xRegisteredObject instanceof CallableClass)
473 473
         {
474 474
             // Set the protected attributes of the object
475 475
             $cSetter = function() use($xTarget) {
Please login to merge, or discard this patch.