Passed
Branch main (b9eaa8)
by Thierry
03:26
created
src/Script/Call/Parameter.php 2 patches
Switch Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -161,28 +161,28 @@
 block discarded – undo
161 161
     {
162 162
         switch($this->getType())
163 163
         {
164
-        case self::JS_VALUE:
165
-            return [
166
-                '_type' => 'expr',
167
-                'calls' => [['_type' => 'attr', '_name' => $this->getValue()]],
168
-            ];
169
-        case self::FORM_VALUES:
170
-            return ['_type' => 'form', '_name' => $this->getValue()];
171
-        case self::INPUT_VALUE:
172
-            return ['_type' => 'input', '_name' => $this->getValue()];
173
-        case self::CHECKED_VALUE:
174
-            return ['_type' => 'checked', '_name' => $this->getValue()];
175
-        case self::ELEMENT_INNERHTML:
176
-            return ['_type' => 'html', '_name' => $this->getValue()];
177
-        case self::PAGE_NUMBER:
178
-            return ['_type' => 'page', '_name' => ''];
179
-        case self::QUOTED_VALUE:
180
-        case self::BOOL_VALUE:
181
-        case self::NUMERIC_VALUE:
182
-        case self::JSON_VALUE:
183
-        default:
184
-            // Return the value as is.
185
-            return $this->getValue();
164
+            case self::JS_VALUE:
165
+                return [
166
+                    '_type' => 'expr',
167
+                    'calls' => [['_type' => 'attr', '_name' => $this->getValue()]],
168
+                ];
169
+            case self::FORM_VALUES:
170
+                return ['_type' => 'form', '_name' => $this->getValue()];
171
+            case self::INPUT_VALUE:
172
+                return ['_type' => 'input', '_name' => $this->getValue()];
173
+            case self::CHECKED_VALUE:
174
+                return ['_type' => 'checked', '_name' => $this->getValue()];
175
+            case self::ELEMENT_INNERHTML:
176
+                return ['_type' => 'html', '_name' => $this->getValue()];
177
+            case self::PAGE_NUMBER:
178
+                return ['_type' => 'page', '_name' => ''];
179
+            case self::QUOTED_VALUE:
180
+            case self::BOOL_VALUE:
181
+            case self::NUMERIC_VALUE:
182
+            case self::JSON_VALUE:
183
+            default:
184
+                // Return the value as is.
185
+                return $this->getValue();
186 186
         }
187 187
     }
188 188
 
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -130,19 +130,19 @@  discard block
 block discarded – undo
130 130
      */
131 131
     public static function make($xValue): ParameterInterface
132 132
     {
133
-        if($xValue instanceof ParameterInterface)
133
+        if ($xValue instanceof ParameterInterface)
134 134
         {
135 135
             return $xValue;
136 136
         }
137
-        if(is_numeric($xValue))
137
+        if (is_numeric($xValue))
138 138
         {
139 139
             return new Parameter(self::NUMERIC_VALUE, $xValue);
140 140
         }
141
-        if(is_string($xValue))
141
+        if (is_string($xValue))
142 142
         {
143 143
             return new Parameter(self::QUOTED_VALUE, $xValue);
144 144
         }
145
-        if(is_bool($xValue))
145
+        if (is_bool($xValue))
146 146
         {
147 147
             return new Parameter(self::BOOL_VALUE, $xValue);
148 148
         }
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
      */
160 160
     public function jsonSerialize(): mixed
161 161
     {
162
-        switch($this->getType())
162
+        switch ($this->getType())
163 163
         {
164 164
         case self::JS_VALUE:
165 165
             return [
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
      */
279 279
     protected function getNumericValueScript(): string
280 280
     {
281
-        return (string)$this->xValue;
281
+        return (string) $this->xValue;
282 282
     }
283 283
 
284 284
     /**
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
      */
289 289
     protected function getUnquotedValueScript(): string
290 290
     {
291
-        return (string)$this->xValue;
291
+        return (string) $this->xValue;
292 292
     }
293 293
 
294 294
     /**
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
      */
311 311
     protected function getPageNumberScript(): string
312 312
     {
313
-        return (string)$this->xValue;
313
+        return (string) $this->xValue;
314 314
     }
315 315
 
316 316
     /**
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
     public function getScript(): string
322 322
     {
323 323
         $sMethodName = 'get' . $this->sType . 'Script';
324
-        if(!method_exists($this, $sMethodName))
324
+        if (!method_exists($this, $sMethodName))
325 325
         {
326 326
             return '';
327 327
         }
Please login to merge, or discard this patch.
src/Request/Handler/CallbackManager.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
      */
99 99
     public function popBootCallbacks(): array
100 100
     {
101
-        if(empty($this->aBootCallbacks))
101
+        if (empty($this->aBootCallbacks))
102 102
         {
103 103
             return [];
104 104
         }
@@ -117,9 +117,9 @@  discard block
 block discarded – undo
117 117
     private function getExceptionCallbacks(Exception $xException): array
118 118
     {
119 119
         $aExceptionCallbacks = [];
120
-        foreach($this->aExceptionCallbacks as $sExClass => $aCallbacks)
120
+        foreach ($this->aExceptionCallbacks as $sExClass => $aCallbacks)
121 121
         {
122
-            if(is_a($xException, $sExClass))
122
+            if (is_a($xException, $sExClass))
123 123
             {
124 124
                 $aExceptionCallbacks = array_merge($aExceptionCallbacks, $aCallbacks);
125 125
             }
@@ -189,13 +189,13 @@  discard block
 block discarded – undo
189 189
      */
190 190
     public function error(callable $xCallable, string $sExClass = ''): CallbackManager
191 191
     {
192
-        if($sExClass === '' || $sExClass === Exception::class)
192
+        if ($sExClass === '' || $sExClass === Exception::class)
193 193
         {
194 194
             $this->aErrorCallbacks[] = $xCallable;
195 195
             return $this;
196 196
         }
197 197
         // Callback for a given exception class
198
-        if(isset($this->aExceptionCallbacks[$sExClass]))
198
+        if (isset($this->aExceptionCallbacks[$sExClass]))
199 199
         {
200 200
             $this->aExceptionCallbacks[$sExClass][] = $xCallable;
201 201
             return $this;
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
      */
237 237
     private function executeCallbacks(array $aCallbacks, array $aParameters)
238 238
     {
239
-        foreach($aCallbacks as $xCallback)
239
+        foreach ($aCallbacks as $xCallback)
240 240
         {
241 241
             $this->executeCallback($xCallback, $aParameters);
242 242
         }
@@ -266,10 +266,10 @@  discard block
 block discarded – undo
266 266
     public function onBefore(Target $xTarget, bool &$bEndRequest)
267 267
     {
268 268
         // Call the user defined callback
269
-        foreach($this->aBeforeCallbacks as $xCallback)
269
+        foreach ($this->aBeforeCallbacks as $xCallback)
270 270
         {
271 271
             $this->executeCallback($xCallback, [$xTarget, &$bEndRequest]);
272
-            if($bEndRequest)
272
+            if ($bEndRequest)
273 273
             {
274 274
                 return;
275 275
             }
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
     {
317 317
         $aExceptionCallbacks = $this->getExceptionCallbacks($xException);
318 318
         $this->executeCallbacks($aExceptionCallbacks, [$xException]);
319
-        if(count($aExceptionCallbacks) > 0)
319
+        if (count($aExceptionCallbacks) > 0)
320 320
         {
321 321
             // Do not throw the exception if a custom handler is defined
322 322
             return;
Please login to merge, or discard this patch.
src/Di/Traits/AttributeTrait.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
         $this->set('metadata_reader_null', function() {
37 37
             return new class implements CallableMetadataInterface
38 38
             {
39
-                public function getAttributes(ReflectionClass|string $xReflectionClass,
39
+                public function getAttributes(ReflectionClass | string $xReflectionClass,
40 40
                     array $aMethods = [], array $aProperties = []): array
41 41
                 {
42 42
                     return [false, [], []];
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
      */
55 55
     public function getMetadataReader(string $sReaderId): CallableMetadataInterface
56 56
     {
57
-        if(($sReaderId === 'attributes' || $sReaderId === 'annotations')
57
+        if (($sReaderId === 'attributes' || $sReaderId === 'annotations')
58 58
             && $this->h("metadata_reader_$sReaderId"))
59 59
         {
60 60
             return $this->g("metadata_reader_$sReaderId");
Please login to merge, or discard this patch.
src/Di/Traits/PluginTrait.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -157,7 +157,7 @@
 block discarded – undo
157 157
     public function registerPackage(string $sClassName, Config $xPkgConfig)
158 158
     {
159 159
         // Register the user class, but only if the user didn't already.
160
-        if(!$this->h($sClassName))
160
+        if (!$this->h($sClassName))
161 161
         {
162 162
             $this->set($sClassName, function() use($sClassName) {
163 163
                 return $this->make($sClassName);
Please login to merge, or discard this patch.
src/Di/ClassContainer.php 3 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
      */
119 119
     public function set(string $sClass, Closure $xClosure)
120 120
     {
121
-       $this->xContainer->offsetSet($sClass, function() use($xClosure) {
121
+        $this->xContainer->offsetSet($sClass, function() use($xClosure) {
122 122
             return $xClosure($this);
123 123
         });
124 124
     }
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
      */
134 134
     public function val(string $sKey, $xValue)
135 135
     {
136
-       $this->xContainer->offsetSet($sKey, $xValue);
136
+        $this->xContainer->offsetSet($sKey, $xValue);
137 137
     }
138 138
 
139 139
     /**
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -159,19 +159,19 @@  discard block
 block discarded – undo
159 159
     private function getClassOptions(string $sClassName): array
160 160
     {
161 161
         // Find options for a class registered with namespace.
162
-        if(!isset($this->aClasses[$sClassName]))
162
+        if (!isset($this->aClasses[$sClassName]))
163 163
         {
164 164
             /** @var CallableRegistry */
165 165
             $xRegistry = $this->di->g(CallableRegistry::class);
166 166
             $xRegistry->setNamespaceClassOptions($sClassName);
167
-            if(!isset($this->aClasses[$sClassName]))
167
+            if (!isset($this->aClasses[$sClassName]))
168 168
             {
169 169
                 // Find options for a class registered without namespace.
170 170
                 // We then need to parse all classes to be able to find one.
171 171
                 $xRegistry->parseDirectories();
172 172
             }
173 173
         }
174
-        if(isset($this->aClasses[$sClassName]))
174
+        if (isset($this->aClasses[$sClassName]))
175 175
         {
176 176
             return $this->aClasses[$sClassName];
177 177
         }
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
     public function getCallableObjects(): array
190 190
     {
191 191
         $aCallableObjects = [];
192
-        foreach($this->aClasses as $sClassName => $_)
192
+        foreach ($this->aClasses as $sClassName => $_)
193 193
         {
194 194
             $this->registerCallableClass($sClassName);
195 195
             $aCallableObjects[$sClassName] = $this->getCallableObject($sClassName);
@@ -208,15 +208,15 @@  discard block
 block discarded – undo
208 208
     {
209 209
         $xType = $xParameter->getType();
210 210
         // Check the parameter class first.
211
-        if($xType instanceof ReflectionNamedType)
211
+        if ($xType instanceof ReflectionNamedType)
212 212
         {
213 213
             // Check the class + the name
214
-            if($this->di->has($xType->getName() . ' $' . $xParameter->getName()))
214
+            if ($this->di->has($xType->getName() . ' $' . $xParameter->getName()))
215 215
             {
216 216
                 return $this->di->get($xType->getName() . ' $' . $xParameter->getName());
217 217
             }
218 218
             // Check the class only
219
-            if($this->di->has($xType->getName()))
219
+            if ($this->di->has($xType->getName()))
220 220
             {
221 221
                 return $this->di->get($xType->getName());
222 222
             }
@@ -236,16 +236,16 @@  discard block
 block discarded – undo
236 236
      */
237 237
     public function make($xClass)
238 238
     {
239
-        if(is_string($xClass))
239
+        if (is_string($xClass))
240 240
         {
241 241
             $xClass = new ReflectionClass($xClass); // Create the reflection class instance
242 242
         }
243
-        if(!($xClass instanceof ReflectionClass))
243
+        if (!($xClass instanceof ReflectionClass))
244 244
         {
245 245
             return null;
246 246
         }
247 247
         // Use the Reflection class to get the parameters of the constructor
248
-        if(($constructor = $xClass->getConstructor()) === null)
248
+        if (($constructor = $xClass->getConstructor()) === null)
249 249
         {
250 250
             return $xClass->newInstance();
251 251
         }
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
     {
313 313
         $sCallableObject = $this->getCallableObjectKey($sClassName);
314 314
         // Prevent duplication. It's important not to use the class name here.
315
-        if($this->has($sCallableObject))
315
+        if ($this->has($sCallableObject))
316 316
         {
317 317
             return;
318 318
         }
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
             isset($aOptions['include']) && require_once($aOptions['include']);
336 336
             $this->val($this->getReflectionClassKey($sClassName), new ReflectionClass($sClassName));
337 337
         }
338
-        catch(ReflectionException $e)
338
+        catch (ReflectionException $e)
339 339
         {
340 340
             $xTranslator = $this->di->g(Translator::class);
341 341
             throw new SetupException($xTranslator->trans('errors.class.invalid', ['name' => $sClassName]));
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
         });
352 352
 
353 353
         // Register the user class, but only if the user didn't already.
354
-        if(!$this->has($sClassName))
354
+        if (!$this->has($sClassName))
355 355
         {
356 356
             $this->set($sClassName, function() use($sClassName) {
357 357
                 return $this->make($this->get($this->getReflectionClassKey($sClassName)));
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
         }
360 360
         // Initialize the user class instance
361 361
         $this->xContainer->extend($sClassName, function($xClassInstance) use($sClassName) {
362
-            if($xClassInstance instanceof AbstractCallable)
362
+            if ($xClassInstance instanceof AbstractCallable)
363 363
             {
364 364
                 $xClassInstance->_initCallable($this->di, $this->get($this->getCallableHelperKey($sClassName)));
365 365
             }
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
         // Replace all separators ('.' and '_') with antislashes, and remove the antislashes
404 404
         // at the beginning and the end of the class name.
405 405
         $sClassName = trim(str_replace('.', '\\', $sClassName), '\\');
406
-        if($this->bUsingUnderscore)
406
+        if ($this->bUsingUnderscore)
407 407
         {
408 408
             $sClassName = trim(str_replace('_', '\\', $sClassName), '\\');
409 409
         }
@@ -470,7 +470,7 @@  discard block
 block discarded – undo
470 470
     private function registerRequestFactory(string $sClassName, string $sFactoryKey)
471 471
     {
472 472
         $this->xContainer->offsetSet($sFactoryKey, function() use($sClassName) {
473
-            if(!($xCallable = $this->makeCallableObject($sClassName)))
473
+            if (!($xCallable = $this->makeCallableObject($sClassName)))
474 474
             {
475 475
                 return null;
476 476
             }
@@ -491,7 +491,7 @@  discard block
 block discarded – undo
491 491
     {
492 492
         $sClassName = trim($sClassName, " \t") ?: JxnCall::class;
493 493
         $sFactoryKey = $this->getRequestFactoryKey($sClassName);
494
-        if(!$this->has($sFactoryKey))
494
+        if (!$this->has($sFactoryKey))
495 495
         {
496 496
             $this->registerRequestFactory($sClassName, $sFactoryKey);
497 497
         }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -334,8 +334,7 @@
 block discarded – undo
334 334
             // Make sure the registered class exists
335 335
             isset($aOptions['include']) && require_once($aOptions['include']);
336 336
             $this->val($this->getReflectionClassKey($sClassName), new ReflectionClass($sClassName));
337
-        }
338
-        catch(ReflectionException $e)
337
+        } catch(ReflectionException $e)
339 338
         {
340 339
             $xTranslator = $this->di->g(Translator::class);
341 340
             throw new SetupException($xTranslator->trans('errors.class.invalid', ['name' => $sClassName]));
Please login to merge, or discard this patch.
src/App/Cache/Cache.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@
 block discarded – undo
31 31
     public function get(string $key, mixed $default = null): mixed
32 32
     {
33 33
         $value = $this->values[$key] ?? $default;
34
-        if(is_callable($value))
34
+        if (is_callable($value))
35 35
         {
36 36
             $value = $value();
37 37
             // Save the value returned by the callback in the cache.
Please login to merge, or discard this patch.
src/App/Ajax/SendTrait.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -33,24 +33,24 @@  discard block
 block discarded – undo
33 33
      */
34 34
     public function sendResponse()
35 35
     {
36
-        if(!$this->xConfigManager->getOption('core.response.send', false))
36
+        if (!$this->xConfigManager->getOption('core.response.send', false))
37 37
         {
38 38
             return;
39 39
         }
40 40
 
41 41
         // Check to see if headers have already been sent out, in which case we can't do our job
42
-        if(headers_sent($sFilename, $nLineNumber))
42
+        if (headers_sent($sFilename, $nLineNumber))
43 43
         {
44 44
             throw new RequestException($this->xTranslator->trans('errors.output.already-sent',
45 45
                     ['location' => $sFilename . ':' . $nLineNumber]) . "\n" .
46 46
                 $this->xTranslator->trans('errors.output.advice'));
47 47
         }
48
-        if(empty($sContent = $this->xResponseManager->getOutput()))
48
+        if (empty($sContent = $this->xResponseManager->getOutput()))
49 49
         {
50 50
             return;
51 51
         }
52 52
 
53
-        if($this->di()->getRequest()->getMethod() === 'GET')
53
+        if ($this->di()->getRequest()->getMethod() === 'GET')
54 54
         {
55 55
             header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
56 56
             header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 
62 62
         print $sContent;
63 63
 
64
-        if($this->xConfigManager->getOption('core.process.exit', false))
64
+        if ($this->xConfigManager->getOption('core.process.exit', false))
65 65
         {
66 66
             exit();
67 67
         }
Please login to merge, or discard this patch.
src/App/Ajax/Bootstrap.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -117,11 +117,11 @@  discard block
 block discarded – undo
117 117
         // Jaxon library settings
118 118
         $this->xConfigManager->setOption('js.app.export', $bExport);
119 119
         $this->xConfigManager->setOption('js.app.minify', $bMinify);
120
-        if($sUri !== '')
120
+        if ($sUri !== '')
121 121
         {
122 122
             $this->xConfigManager->setOption('js.app.uri', $sUri);
123 123
         }
124
-        if($sDir !== '')
124
+        if ($sDir !== '')
125 125
         {
126 126
             $this->xConfigManager->setOption('js.app.dir', $sDir);
127 127
         }
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
     {
174 174
         // Only call the callbacks that aren't called yet.
175 175
         $aBootCallbacks = $this->xCallbackManager->popBootCallbacks();
176
-        foreach($aBootCallbacks as $aBootCallback)
176
+        foreach ($aBootCallbacks as $aBootCallback)
177 177
         {
178 178
             call_user_func($aBootCallback);
179 179
         }
Please login to merge, or discard this patch.
src/App/Ajax/App.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
      */
33 33
     public function setup(string $sConfigFile = '')
34 34
     {
35
-        if(!file_exists($sConfigFile))
35
+        if (!file_exists($sConfigFile))
36 36
         {
37 37
             $sMessage = $this->xTranslator->trans('errors.file.access', ['path' => $sConfigFile]);
38 38
             throw new SetupException($sMessage);
@@ -42,13 +42,13 @@  discard block
 block discarded – undo
42 42
         $aOptions = $this->xConfigManager->read($sConfigFile);
43 43
         $aLibOptions = $aOptions['lib'] ?? [];
44 44
         $aAppOptions = $aOptions['app'] ?? [];
45
-        if(!is_array($aLibOptions) || !is_array($aAppOptions))
45
+        if (!is_array($aLibOptions) || !is_array($aAppOptions))
46 46
         {
47 47
             $sMessage = $this->xTranslator->trans('errors.file.content', ['path' => $sConfigFile]);
48 48
             throw new SetupException($sMessage);
49 49
         }
50 50
         // The bootstrap set this to false. It needs to be changed.
51
-        if(!isset($aLibOptions['core']['response']['send']))
51
+        if (!isset($aLibOptions['core']['response']['send']))
52 52
         {
53 53
             $aLibOptions['core']['response']['send'] = true;
54 54
         }
Please login to merge, or discard this patch.