Passed
Branch main (63e847)
by Thierry
11:05
created
src/Request/Call/Parameter.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -116,19 +116,19 @@  discard block
 block discarded – undo
116 116
      */
117 117
     public static function make($xValue): ParameterInterface
118 118
     {
119
-        if($xValue instanceof ParameterInterface)
119
+        if ($xValue instanceof ParameterInterface)
120 120
         {
121 121
             return $xValue;
122 122
         }
123
-        if(is_numeric($xValue))
123
+        if (is_numeric($xValue))
124 124
         {
125 125
             return new Parameter(self::NUMERIC_VALUE, $xValue);
126 126
         }
127
-        if(is_string($xValue))
127
+        if (is_string($xValue))
128 128
         {
129 129
             return new Parameter(self::QUOTED_VALUE, $xValue);
130 130
         }
131
-        if(is_bool($xValue))
131
+        if (is_bool($xValue))
132 132
         {
133 133
             return new Parameter(self::BOOL_VALUE, $xValue);
134 134
         }
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
      */
231 231
     protected function getNumericValueScript(): string
232 232
     {
233
-        return (string)$this->xValue;
233
+        return (string) $this->xValue;
234 234
     }
235 235
 
236 236
     /**
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
      */
241 241
     protected function getUnquotedValueScript(): string
242 242
     {
243
-        return (string)$this->xValue;
243
+        return (string) $this->xValue;
244 244
     }
245 245
 
246 246
     /**
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
      */
263 263
     protected function getPageNumberScript(): string
264 264
     {
265
-        return (string)$this->xValue;
265
+        return (string) $this->xValue;
266 266
     }
267 267
 
268 268
     /**
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
     public function getScript(): string
274 274
     {
275 275
         $sMethodName = 'get' . $this->sType . 'Script';
276
-        if(!method_exists($this, $sMethodName))
276
+        if (!method_exists($this, $sMethodName))
277 277
         {
278 278
             return '';
279 279
         }
Please login to merge, or discard this patch.
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
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -118,15 +118,15 @@  discard block
 block discarded – undo
118 118
      */
119 119
     public function checkOptions(string $sCallable, $xOptions): array
120 120
     {
121
-        if(!$this->xValidator->validateFunction(trim($sCallable)))
121
+        if (!$this->xValidator->validateFunction(trim($sCallable)))
122 122
         {
123 123
             throw new SetupException($this->xTranslator->trans('errors.objects.invalid-declaration'));
124 124
         }
125
-        if(is_string($xOptions))
125
+        if (is_string($xOptions))
126 126
         {
127 127
             $xOptions = ['include' => $xOptions];
128 128
         }
129
-        elseif(!is_array($xOptions))
129
+        elseif (!is_array($xOptions))
130 130
         {
131 131
             throw new SetupException($this->xTranslator->trans('errors.objects.invalid-declaration'));
132 132
         }
@@ -147,9 +147,9 @@  discard block
 block discarded – undo
147 147
         $sPhpFunction = trim($sCallable);
148 148
         $sFunction = $sPhpFunction;
149 149
         // Check if an alias is defined
150
-        if(isset($aOptions['alias']))
150
+        if (isset($aOptions['alias']))
151 151
         {
152
-            $sFunction = (string)$aOptions['alias'];
152
+            $sFunction = (string) $aOptions['alias'];
153 153
             unset($aOptions['alias']);
154 154
         }
155 155
         $this->aFunctions[$sFunction] = $sPhpFunction;
@@ -171,12 +171,12 @@  discard block
 block discarded – undo
171 171
     public function getCallable(string $sCallable)
172 172
     {
173 173
         $sFunction = trim($sCallable);
174
-        if(!isset($this->aFunctions[$sFunction]))
174
+        if (!isset($this->aFunctions[$sFunction]))
175 175
         {
176 176
             return null;
177 177
         }
178 178
         $xCallable = new CallableFunction($sFunction, $this->sPrefix . $sFunction, $this->aFunctions[$sFunction]);
179
-        foreach($this->aOptions[$sFunction] as $sName => $sValue)
179
+        foreach ($this->aOptions[$sFunction] as $sName => $sValue)
180 180
         {
181 181
             $xCallable->configure($sName, $sValue);
182 182
         }
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
     public function getScript(): string
206 206
     {
207 207
         $code = '';
208
-        foreach(array_keys($this->aFunctions) as $sFunction)
208
+        foreach (array_keys($this->aFunctions) as $sFunction)
209 209
         {
210 210
             $xFunction = $this->getCallable($sFunction);
211 211
             $code .= $this->getCallableScript($xFunction);
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
     public static function canProcessRequest(ServerRequestInterface $xRequest): bool
220 220
     {
221 221
         $aBody = $xRequest->getParsedBody();
222
-        if(is_array($aBody))
222
+        if (is_array($aBody))
223 223
         {
224 224
             return isset($aBody['jxnfun']);
225 225
         }
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
     public function setTarget(ServerRequestInterface $xRequest)
234 234
     {
235 235
         $aBody = $xRequest->getParsedBody();
236
-        if(is_array($aBody))
236
+        if (is_array($aBody))
237 237
         {
238 238
             $this->xTarget = Target::makeFunction(trim($aBody['jxnfun']));
239 239
             return;
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
         $sRequestedFunction = $this->xTarget->getFunctionName();
252 252
 
253 253
         // Security check: make sure the requested function was registered.
254
-        if(!$this->xValidator->validateFunction($sRequestedFunction) ||
254
+        if (!$this->xValidator->validateFunction($sRequestedFunction) ||
255 255
             !isset($this->aFunctions[$sRequestedFunction]))
256 256
         {
257 257
             // Unable to find the requested function
Please login to merge, or discard this patch.
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.
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
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
      */
113 113
     public function configure(string $sName, string $sValue)
114 114
     {
115
-        switch($sName)
115
+        switch ($sName)
116 116
         {
117 117
         case 'class': // The user function is a method in the given class
118 118
             $this->xPhpFunction = [$sValue, $this->xPhpFunction];
@@ -136,12 +136,12 @@  discard block
 block discarded – undo
136 136
      */
137 137
     public function call(array $aArgs = [])
138 138
     {
139
-        if(($this->sInclude))
139
+        if (($this->sInclude))
140 140
         {
141 141
             require_once $this->sInclude;
142 142
         }
143 143
         // If the function is an alias for a class method, then instantiate the class
144
-        if(is_array($this->xPhpFunction) && is_string($this->xPhpFunction[0]))
144
+        if (is_array($this->xPhpFunction) && is_string($this->xPhpFunction[0]))
145 145
         {
146 146
             $sClassName = $this->xPhpFunction[0];
147 147
             $this->xPhpFunction[0] = new $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.