Passed
Branch main (a85ff2)
by Thierry
03:08
created
src/Plugin/Request/CallableClass/SortedFileIterator.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
28 28
     public function __construct(string $sDirectory)
29 29
     {
30 30
         $itFile = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($sDirectory));
31
-        foreach($itFile as $xFile)
31
+        foreach ($itFile as $xFile)
32 32
         {
33 33
             $this->insert($xFile);
34 34
         }
Please login to merge, or discard this patch.
src/Plugin/Request/CallableClass/CallableDirPlugin.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
     private function checkDirectory(string $sDirectory): string
69 69
     {
70 70
         $sDirectory = rtrim(trim($sDirectory), '/\\');
71
-        if(!is_dir($sDirectory))
71
+        if (!is_dir($sDirectory))
72 72
         {
73 73
             throw new SetupException($this->xTranslator->trans('errors.objects.invalid-declaration'));
74 74
         }
@@ -81,11 +81,11 @@  discard block
 block discarded – undo
81 81
      */
82 82
     public function checkOptions(string $sCallable, $xOptions): array
83 83
     {
84
-        if(is_string($xOptions))
84
+        if (is_string($xOptions))
85 85
         {
86 86
             $xOptions = ['namespace' => $xOptions];
87 87
         }
88
-        if(!is_array($xOptions))
88
+        if (!is_array($xOptions))
89 89
         {
90 90
             throw new SetupException($this->xTranslator->trans('errors.objects.invalid-declaration'));
91 91
         }
@@ -93,14 +93,14 @@  discard block
 block discarded – undo
93 93
         $xOptions['directory'] = $this->checkDirectory($sCallable);
94 94
         // Check the namespace
95 95
         $sNamespace = $xOptions['namespace'] ?? '';
96
-        if(!($xOptions['namespace'] = trim($sNamespace, ' \\')))
96
+        if (!($xOptions['namespace'] = trim($sNamespace, ' \\')))
97 97
         {
98 98
             $xOptions['namespace'] = '';
99 99
         }
100 100
 
101 101
         // Change the keys in $xOptions to have "\" as separator
102 102
         $_aOptions = [];
103
-        foreach($xOptions as $sName => $aOption)
103
+        foreach ($xOptions as $sName => $aOption)
104 104
         {
105 105
             $sName = trim(str_replace('.', '\\', $sName), ' \\');
106 106
             $_aOptions[$sName] = $aOption;
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
      */
114 114
     public function register(string $sType, string $sCallable, array $aOptions): bool
115 115
     {
116
-        if(($aOptions['namespace']))
116
+        if (($aOptions['namespace']))
117 117
         {
118 118
             $this->xRegistry->registerNamespace($aOptions['namespace'], $aOptions);
119 119
             return true;
Please login to merge, or discard this patch.
src/Plugin/Request/CallableClass/CallableObject.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
     {
119 119
         /** @var Config|null */
120 120
         $xConfig = $aOptions['config'] ?? null;
121
-        if($xConfig === null)
121
+        if ($xConfig === null)
122 122
         {
123 123
             return null;
124 124
         }
@@ -278,11 +278,11 @@  discard block
 block discarded – undo
278 278
         $sMethod = $this->xTarget->getMethodName();
279 279
         // The hooks defined at method level are merged with those defined at class level.
280 280
         $aMethods = array_merge($aHookMethods['*'] ?? [], $aHookMethods[$sMethod] ?? []);
281
-        foreach($aMethods as $xKey => $xValue)
281
+        foreach ($aMethods as $xKey => $xValue)
282 282
         {
283 283
             $sHookName = $xValue;
284 284
             $aHookArgs = [];
285
-            if(is_string($xKey))
285
+            if (is_string($xKey))
286 286
             {
287 287
                 $sHookName = $xKey;
288 288
                 $aHookArgs = is_array($xValue) ? $xValue : [$xValue];
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
             // Warning: dynamic properties will be deprecated in PHP8.2.
305 305
             $this->$sName = $xInjectedObject;
306 306
         };
307
-        foreach($aDiOptions as $sName => $sClass)
307
+        foreach ($aDiOptions as $sName => $sClass)
308 308
         {
309 309
             // The setter has access to protected attributes
310 310
             $_cSetter = $cSetter->bindTo($xRegisteredObject, $xRegisteredObject);
@@ -345,7 +345,7 @@  discard block
 block discarded – undo
345 345
     public function getRegisteredObject(?Target $xTarget = null)
346 346
     {
347 347
         $xRegisteredObject = $this->cls->get($this->getClassName());
348
-        if(!$xRegisteredObject || !$xTarget)
348
+        if (!$xRegisteredObject || !$xTarget)
349 349
         {
350 350
             return $xRegisteredObject;
351 351
         }
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
         // We now need to set the method level DI options.
356 356
         $this->setDiMethodAttributes($xRegisteredObject, $xTarget->getMethodName());
357 357
         // Set the Jaxon request target in the helper
358
-        if($xRegisteredObject instanceof AbstractCallable)
358
+        if ($xRegisteredObject instanceof AbstractCallable)
359 359
         {
360 360
             // Set the protected attributes of the object
361 361
             $sAttr = 'xHelper';
Please login to merge, or discard this patch.
src/Plugin/Request/CallableFunction/CallableFunctionPlugin.php 2 patches
Spacing   +12 added lines, -13 removed lines patch added patch discarded remove patch
@@ -86,15 +86,15 @@  discard block
 block discarded – undo
86 86
      */
87 87
     public function checkOptions(string $sCallable, $xOptions): array
88 88
     {
89
-        if(!$this->xValidator->validateFunction(trim($sCallable)))
89
+        if (!$this->xValidator->validateFunction(trim($sCallable)))
90 90
         {
91 91
             throw new SetupException($this->xTranslator->trans('errors.objects.invalid-declaration'));
92 92
         }
93
-        if(is_string($xOptions))
93
+        if (is_string($xOptions))
94 94
         {
95 95
             $xOptions = ['include' => $xOptions];
96 96
         }
97
-        elseif(!is_array($xOptions))
97
+        elseif (!is_array($xOptions))
98 98
         {
99 99
             throw new SetupException($this->xTranslator->trans('errors.objects.invalid-declaration'));
100 100
         }
@@ -115,9 +115,9 @@  discard block
 block discarded – undo
115 115
         $sPhpFunction = trim($sCallable);
116 116
         $sFunction = $sPhpFunction;
117 117
         // Check if an alias is defined
118
-        if(isset($aOptions['alias']))
118
+        if (isset($aOptions['alias']))
119 119
         {
120
-            $sFunction = (string)$aOptions['alias'];
120
+            $sFunction = (string) $aOptions['alias'];
121 121
             unset($aOptions['alias']);
122 122
         }
123 123
         $this->aFunctions[$sFunction] = $sPhpFunction;
@@ -139,13 +139,13 @@  discard block
 block discarded – undo
139 139
     public function getCallable(string $sCallable)
140 140
     {
141 141
         $sFunction = trim($sCallable);
142
-        if(!isset($this->aFunctions[$sFunction]))
142
+        if (!isset($this->aFunctions[$sFunction]))
143 143
         {
144 144
             return null;
145 145
         }
146 146
         $xCallable = new CallableFunction($this->di, $sFunction,
147 147
             $this->sPrefix . $sFunction, $this->aFunctions[$sFunction]);
148
-        foreach($this->aOptions[$sFunction] as $sName => $sValue)
148
+        foreach ($this->aOptions[$sFunction] as $sName => $sValue)
149 149
         {
150 150
             $xCallable->configure($sName, $sValue);
151 151
         }
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
     public function getScript(): string
175 175
     {
176 176
         $code = '';
177
-        foreach(array_keys($this->aFunctions) as $sFunction)
177
+        foreach (array_keys($this->aFunctions) as $sFunction)
178 178
         {
179 179
             $xFunction = $this->getCallable($sFunction);
180 180
             $code .= $this->getCallableScript($xFunction);
@@ -212,8 +212,7 @@  discard block
 block discarded – undo
212 212
     private function throwException(Exception $xException, string $sErrorMessage): void
213 213
     {
214 214
         $this->di->getLogger()->error($xException->getMessage());
215
-        throw new RequestException($sErrorMessage . (!$this->bDebug ? '' :
216
-            "\n" . $xException->getMessage()));
215
+        throw new RequestException($sErrorMessage . (!$this->bDebug ? '' : "\n" . $xException->getMessage()));
217 216
     }
218 217
 
219 218
     /**
@@ -225,7 +224,7 @@  discard block
 block discarded – undo
225 224
         $sRequestedFunction = $this->xTarget->getFunctionName();
226 225
 
227 226
         // Security check: make sure the requested function was registered.
228
-        if(!$this->xValidator->validateFunction($sRequestedFunction) ||
227
+        if (!$this->xValidator->validateFunction($sRequestedFunction) ||
229 228
             !isset($this->aFunctions[$sRequestedFunction]))
230 229
         {
231 230
             // Unable to find the requested function
@@ -238,7 +237,7 @@  discard block
 block discarded – undo
238 237
             /** @var CallableFunction */
239 238
             $xFunction = $this->getCallable($sRequestedFunction);
240 239
         }
241
-        catch(Exception $e)
240
+        catch (Exception $e)
242 241
         {
243 242
             // Unable to find the requested function
244 243
             $this->throwException($e, $this->xTranslator->trans('errors.functions.invalid',
@@ -248,7 +247,7 @@  discard block
 block discarded – undo
248 247
         {
249 248
             return $xFunction->call($this->xTarget->args());
250 249
         }
251
-        catch(Exception $e)
250
+        catch (Exception $e)
252 251
         {
253 252
             // Unable to execute the requested function
254 253
             $this->throwException($e, $this->xTranslator->trans('errors.functions.call',
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -93,8 +93,7 @@  discard block
 block discarded – undo
93 93
         if(is_string($xOptions))
94 94
         {
95 95
             $xOptions = ['include' => $xOptions];
96
-        }
97
-        elseif(!is_array($xOptions))
96
+        } elseif(!is_array($xOptions))
98 97
         {
99 98
             throw new SetupException($this->xTranslator->trans('errors.objects.invalid-declaration'));
100 99
         }
@@ -237,8 +236,7 @@  discard block
 block discarded – undo
237 236
         {
238 237
             /** @var CallableFunction */
239 238
             $xFunction = $this->getCallable($sRequestedFunction);
240
-        }
241
-        catch(Exception $e)
239
+        } catch(Exception $e)
242 240
         {
243 241
             // Unable to find the requested function
244 242
             $this->throwException($e, $this->xTranslator->trans('errors.functions.invalid',
@@ -247,8 +245,7 @@  discard block
 block discarded – undo
247 245
         try
248 246
         {
249 247
             return $xFunction->call($this->xTarget->args());
250
-        }
251
-        catch(Exception $e)
248
+        } catch(Exception $e)
252 249
         {
253 250
             // Unable to execute the requested function
254 251
             $this->throwException($e, $this->xTranslator->trans('errors.functions.call',
Please login to merge, or discard this patch.
src/App/Stash/Stash.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 stash.
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
@@ -35,19 +35,19 @@  discard block
 block discarded – undo
35 35
      */
36 36
     public function sendResponse(string $sCode = '200')
37 37
     {
38
-        if(!$this->xConfigManager->getOption('core.response.send', false))
38
+        if (!$this->xConfigManager->getOption('core.response.send', false))
39 39
         {
40 40
             return;
41 41
         }
42 42
 
43 43
         // Check to see if headers have already been sent out, in which case we can't do our job
44
-        if(headers_sent($sFilename, $nLineNumber))
44
+        if (headers_sent($sFilename, $nLineNumber))
45 45
         {
46 46
             throw new RequestException($this->xTranslator->trans('errors.output.already-sent',
47 47
                     ['location' => $sFilename . ':' . $nLineNumber]) . "\n" .
48 48
                 $this->xTranslator->trans('errors.output.advice'));
49 49
         }
50
-        if(empty($sContent = $this->xResponseManager->getOutput()))
50
+        if (empty($sContent = $this->xResponseManager->getOutput()))
51 51
         {
52 52
             return;
53 53
         }
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
         // Set the HTTP response code
56 56
         http_response_code(intval($sCode));
57 57
 
58
-        if($this->di()->getRequest()->getMethod() === 'GET')
58
+        if ($this->di()->getRequest()->getMethod() === 'GET')
59 59
         {
60 60
             header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
61 61
             header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 
67 67
         print $sContent;
68 68
 
69
-        if($this->xConfigManager->getOption('core.process.exit', false))
69
+        if ($this->xConfigManager->getOption('core.process.exit', false))
70 70
         {
71 71
             exit();
72 72
         }
Please login to merge, or discard this patch.
src/App/Metadata/InputData.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@
 block discarded – undo
30 30
      * @param array $aMethods
31 31
      * @param array $aProperties
32 32
      */
33
-    public function __construct(ReflectionClass|string $xClass,
33
+    public function __construct(ReflectionClass | string $xClass,
34 34
         private array $aMethods = [], private array $aProperties = [])
35 35
     {
36 36
         $this->xReflectionClass = is_string($xClass) ? new ReflectionClass($xClass) : $xClass;
Please login to merge, or discard this patch.
src/App/View/HtmlAttrHelper.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -56,13 +56,13 @@  discard block
 block discarded – undo
56 56
     public function html(JxnCall $xJsCall): string
57 57
     {
58 58
         $sClassName = $xJsCall->_class();
59
-        if(!$sClassName)
59
+        if (!$sClassName)
60 60
         {
61 61
             return '';
62 62
         }
63 63
 
64 64
         $xCallable = $this->cls->makeRegisteredObject($sClassName);
65
-        return is_a($xCallable, Component::class) ? (string)$xCallable->html() : '';
65
+        return is_a($xCallable, Component::class) ? (string) $xCallable->html() : '';
66 66
     }
67 67
 
68 68
     /**
@@ -113,15 +113,15 @@  discard block
 block discarded – undo
113 113
     {
114 114
         // Only accept arrays of 2 entries.
115 115
         $count = count($on);
116
-        if($count !== 2)
116
+        if ($count !== 2)
117 117
         {
118 118
             return false;
119 119
         }
120 120
 
121 121
         // Only accept arrays with int index from 0, and string value.
122
-        for($i = 0; $i < $count; $i++)
122
+        for ($i = 0; $i < $count; $i++)
123 123
         {
124
-            if(!isset($on[$i]) || !is_string($on[$i]))
124
+            if (!isset($on[$i]) || !is_string($on[$i]))
125 125
             {
126 126
                 return false;
127 127
             }
@@ -156,13 +156,13 @@  discard block
 block discarded – undo
156 156
      *
157 157
      * @return string
158 158
      */
159
-    public function on(string|array $on, JsExpr $xJsExpr): string
159
+    public function on(string | array $on, JsExpr $xJsExpr): string
160 160
     {
161 161
         $select = '';
162 162
         $event = $on;
163
-        if(is_array($on))
163
+        if (is_array($on))
164 164
         {
165
-            if(!$this->checkOn($on))
165
+            if (!$this->checkOn($on))
166 166
             {
167 167
                 return '';
168 168
             }
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
      */
197 197
     public function event(array $on, JsExpr $xJsExpr): string
198 198
     {
199
-        if(!$this->checkOn($on))
199
+        if (!$this->checkOn($on))
200 200
         {
201 201
             return '';
202 202
         }
Please login to merge, or discard this patch.
src/App/Component.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
     /**
28 28
      * @return string|Stringable
29 29
      */
30
-    abstract public function html(): string|Stringable;
30
+    abstract public function html(): string | Stringable;
31 31
 
32 32
     /**
33 33
      * Called before rendering the component.
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
     final public function render(): AjaxResponse
54 54
     {
55 55
         $this->before();
56
-        $this->node()->html((string)$this->html());
56
+        $this->node()->html((string) $this->html());
57 57
         $this->after();
58 58
 
59 59
         return $this->response;
Please login to merge, or discard this patch.