Passed
Push — main ( c6b105...31af8b )
by Thierry
07:02
created
jaxon-core/src/Plugin/Code/CodeGenerator.php 1 patch
Spacing   +20 added lines, -22 removed lines patch added patch discarded remove patch
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
      */
110 110
     public function addCodeGenerator(string $sClassName, int $nPriority): void
111 111
     {
112
-        while(isset($this->aCodeGenerators[$nPriority]))
112
+        while (isset($this->aCodeGenerators[$nPriority]))
113 113
         {
114 114
             $nPriority++;
115 115
         }
@@ -163,33 +163,33 @@  discard block
 block discarded – undo
163 163
      */
164 164
     private function generatePluginCodes(CodeGeneratorInterface $xGenerator): void
165 165
     {
166
-        if(!is_subclass_of($xGenerator, AbstractPlugin::class) ||
166
+        if (!is_subclass_of($xGenerator, AbstractPlugin::class) ||
167 167
             $this->xAssetManager->shallIncludeAssets($xGenerator))
168 168
         {
169 169
             // HTML tags for CSS
170
-            if(($sCss = trim($xGenerator->getCss(), " \n")) !== '')
170
+            if (($sCss = trim($xGenerator->getCss(), " \n")) !== '')
171 171
             {
172 172
                 $this->aCss[] = $sCss;
173 173
             }
174 174
             // HTML tags for js
175
-            if(($sJs = trim($xGenerator->getJs(), " \n")) !== '')
175
+            if (($sJs = trim($xGenerator->getJs(), " \n")) !== '')
176 176
             {
177 177
                 $this->aJs[] = $sJs;
178 178
             }
179 179
         }
180 180
 
181 181
         // Additional js codes
182
-        if(($xJsCode = $xGenerator->getJsCode()) !== null)
182
+        if (($xJsCode = $xGenerator->getJsCode()) !== null)
183 183
         {
184
-            if(($sJs = trim($xJsCode->sJs, " \n")) !== '')
184
+            if (($sJs = trim($xJsCode->sJs, " \n")) !== '')
185 185
             {
186 186
                 $this->aCodeJs[] = $sJs;
187 187
             }
188
-            if(($sJsBefore = trim($xJsCode->sJsBefore, " \n")) !== '')
188
+            if (($sJsBefore = trim($xJsCode->sJsBefore, " \n")) !== '')
189 189
             {
190 190
                 $this->aCodeJsBefore[] = $sJsBefore;
191 191
             }
192
-            if(($sJsAfter = trim($xJsCode->sJsAfter, " \n")) !== '')
192
+            if (($sJsAfter = trim($xJsCode->sJsAfter, " \n")) !== '')
193 193
             {
194 194
                 $this->aCodeJsAfter[] = $sJsAfter;
195 195
             }
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
      */
206 206
     private function generateCodes(): void
207 207
     {
208
-        if($this->bGenerated)
208
+        if ($this->bGenerated)
209 209
         {
210 210
             return;
211 211
         }
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
         // Sort the code generators by ascending priority
217 217
         ksort($this->aCodeGenerators);
218 218
 
219
-        foreach($this->aCodeGenerators as $sClassName)
219
+        foreach ($this->aCodeGenerators as $sClassName)
220 220
         {
221 221
             $this->generatePluginCodes($this->getCodeGenerator($sClassName));
222 222
         }
@@ -261,11 +261,11 @@  discard block
 block discarded – undo
261 261
      */
262 262
     public function getJsScript(): string
263 263
     {
264
-        foreach($this->aCodeGenerators as $sClassName)
264
+        foreach ($this->aCodeGenerators as $sClassName)
265 265
         {
266 266
             $xGenerator = $this->getCodeGenerator($sClassName);
267 267
             // Javascript code
268
-            if(($sJsScript = trim($xGenerator->getScript(), " \n")) !== '')
268
+            if (($sJsScript = trim($xGenerator->getScript(), " \n")) !== '')
269 269
             {
270 270
                 $aJsScript[] = $sJsScript;
271 271
             }
@@ -282,38 +282,36 @@  discard block
 block discarded – undo
282 282
     private function renderCodes(bool $bIncludeJs, bool $bIncludeCss): array
283 283
     {
284 284
         $aCodes = [];
285
-        if($bIncludeCss)
285
+        if ($bIncludeCss)
286 286
         {
287 287
             $aCodes[] = $this->getCss();
288 288
         }
289
-        if($bIncludeJs)
289
+        if ($bIncludeJs)
290 290
         {
291 291
             $aCodes[] = $this->getJs();
292 292
         }
293 293
 
294
-        $sUrl = !$this->xAssetManager->shallCreateJsFiles() ? '' :
295
-            $this->xAssetManager->createJsFiles($this);
294
+        $sUrl = !$this->xAssetManager->shallCreateJsFiles() ? '' : $this->xAssetManager->createJsFiles($this);
296 295
         // Wrap the js code into the corresponding HTML tag.
297 296
         $aCodes[] = $sUrl !== '' ?
298
-            $this->render('include.js', ['sUrl' => $sUrl]) :
299
-            $this->render('wrapper.js', ['sScript' => $this->getJsScript()]);
297
+            $this->render('include.js', ['sUrl' => $sUrl]) : $this->render('wrapper.js', ['sScript' => $this->getJsScript()]);
300 298
 
301 299
         // Wrap the js codes into HTML tags.
302
-        if(count($this->aCodeJsBefore) > 0)
300
+        if (count($this->aCodeJsBefore) > 0)
303 301
         {
304 302
             $sScript = implode("\n\n", $this->aCodeJsBefore);
305 303
             $aCodes[] = $this->render('wrapper.js', ['sScript' => $sScript]);
306 304
         }
307
-        if(count($this->aCodeJs) > 0)
305
+        if (count($this->aCodeJs) > 0)
308 306
         {
309 307
             $sScript = implode("\n\n", $this->aCodeJs);
310 308
             $aCodes[] = $this->render('wrapper.js', ['sScript' => $sScript]);
311 309
         }
312
-        if(count($this->aCodeJsFiles) > 0)
310
+        if (count($this->aCodeJsFiles) > 0)
313 311
         {
314 312
             $aCodes[] = $this->render('includes.js', ['aUrls' => $this->aCodeJsFiles]);
315 313
         }
316
-        if(count($this->aCodeJsAfter) > 0)
314
+        if (count($this->aCodeJsAfter) > 0)
317 315
         {
318 316
             $sScript = implode("\n\n", $this->aCodeJsAfter);
319 317
             $aCodes[] = $this->render('wrapper.js', ['sScript' => $sScript]);
Please login to merge, or discard this patch.
jaxon-core/src/Plugin/Code/AssetManager.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
     public function shallIncludeAssets(AbstractPlugin $xPlugin): bool
74 74
     {
75 75
         $sPluginOptionName = 'assets.include.' . $xPlugin->getName();
76
-        if($this->hasLibOption($sPluginOptionName))
76
+        if ($this->hasLibOption($sPluginOptionName))
77 77
         {
78 78
             return $this->getLibOption($sPluginOptionName);
79 79
         }
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
             $this->getLibOption('js.lib.jq', "$sJsLibUri/libs/chibi/chibi$sJsExtension"),
98 98
             "$sJsLibUri/jaxon.core$sJsExtension",
99 99
         ];
100
-        if($this->getLibOption('core.debug.on'))
100
+        if ($this->getLibOption('core.debug.on'))
101 101
         {
102 102
             $sLanguage = $this->getLibOption('core.language');
103 103
             $aJsFiles[] = "$sJsLibUri/jaxon.debug$sJsExtension";
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
         // Check config options
118 118
         // - The js.app.export option must be set to true
119 119
         // - The js.app.uri and js.app.dir options must be set to non null values
120
-        if(!$this->getLibOption('js.app.export', false) ||
120
+        if (!$this->getLibOption('js.app.export', false) ||
121 121
             !$this->getLibOption('js.app.uri') || !$this->getLibOption('js.app.dir'))
122 122
         {
123 123
             return false;
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
         $sJsFileName = $this->getLibOption('js.app.file') ?: $xCodeGenerator->getHash();
139 139
         $sJsDirectory = rtrim($this->getLibOption('js.app.dir'), '\/') . DIRECTORY_SEPARATOR;
140 140
         // - The js.app.dir must be writable
141
-        if(!$sJsFileName || !is_dir($sJsDirectory) || !is_writable($sJsDirectory))
141
+        if (!$sJsFileName || !is_dir($sJsDirectory) || !is_writable($sJsDirectory))
142 142
         {
143 143
             return '';
144 144
         }
@@ -147,16 +147,16 @@  discard block
 block discarded – undo
147 147
         $sJsMinFilePath = $sJsDirectory . $sJsFileName . '.min.js';
148 148
         $sJsFileUri = rtrim($this->getLibOption('js.app.uri'), '/') . "/$sJsFileName";
149 149
 
150
-        if(!is_file($sJsFilePath) &&
150
+        if (!is_file($sJsFilePath) &&
151 151
             !@file_put_contents($sJsFilePath, $xCodeGenerator->getJsScript()))
152 152
         {
153 153
             return '';
154 154
         }
155
-        if(!$this->getLibOption('js.app.minify', false))
155
+        if (!$this->getLibOption('js.app.minify', false))
156 156
         {
157 157
             return $sJsFileUri . '.js';
158 158
         }
159
-        if(!is_file($sJsMinFilePath) &&
159
+        if (!is_file($sJsMinFilePath) &&
160 160
             !$this->xMinifier->minify($sJsFilePath, $sJsMinFilePath))
161 161
         {
162 162
             // If the file cannot be minified, return the plain js file.
Please login to merge, or discard this patch.
jaxon-core/src/Plugin/Request/CallableClass/CallableClassPlugin.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -78,15 +78,15 @@  discard block
 block discarded – undo
78 78
      */
79 79
     public function checkOptions(string $sCallable, $xOptions): array
80 80
     {
81
-        if(!$this->xValidator->validateClass(trim($sCallable)))
81
+        if (!$this->xValidator->validateClass(trim($sCallable)))
82 82
         {
83 83
             throw new SetupException($this->xTranslator->trans('errors.objects.invalid-declaration'));
84 84
         }
85
-        if(is_string($xOptions))
85
+        if (is_string($xOptions))
86 86
         {
87 87
             $xOptions = ['include' => $xOptions];
88 88
         }
89
-        elseif(!is_array($xOptions))
89
+        elseif (!is_array($xOptions))
90 90
         {
91 91
             throw new SetupException($this->xTranslator->trans('errors.objects.invalid-declaration'));
92 92
         }
@@ -130,16 +130,16 @@  discard block
 block discarded – undo
130 130
     {
131 131
         $sCode = '';
132 132
         $aJsClasses = [];
133
-        foreach($this->xRegistry->getNamespaces() as $sNamespace)
133
+        foreach ($this->xRegistry->getNamespaces() as $sNamespace)
134 134
         {
135 135
             $offset = 0;
136 136
             $sJsNamespace = str_replace('\\', '.', $sNamespace);
137 137
             $sJsNamespace .= '.Null'; // This is a sentinel. The last token is not processed in the while loop.
138
-            while(($dotPosition = strpos($sJsNamespace, '.', $offset)) !== false)
138
+            while (($dotPosition = strpos($sJsNamespace, '.', $offset)) !== false)
139 139
             {
140 140
                 $sJsClass = substr($sJsNamespace, 0, $dotPosition);
141 141
                 // Generate code for this object
142
-                if(!isset($aJsClasses[$sJsClass]))
142
+                if (!isset($aJsClasses[$sJsClass]))
143 143
                 {
144 144
                     $sCode .= $this->sPrefix . "$sJsClass = {};\n";
145 145
                     $aJsClasses[$sJsClass] = $sJsClass;
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
      */
160 160
     private function getCallableScript(CallableObject $xCallableObject): string
161 161
     {
162
-        if($xCallableObject->excluded())
162
+        if ($xCallableObject->excluded())
163 163
         {
164 164
             return '';
165 165
         }
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
         // Will be used to print a translated error message.
240 240
         $aErrorParams = ['class' => $sClassName, 'method' => $sMethodName];
241 241
 
242
-        if(!$this->xValidator->validateJsObject($sClassName) ||
242
+        if (!$this->xValidator->validateJsObject($sClassName) ||
243 243
             !$this->xValidator->validateMethod($sMethodName))
244 244
         {
245 245
             // Unable to find the requested object or method
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
             $xCallableObject = $this->getCallable($sClassName);
255 255
 
256 256
             $sError = 'errors.objects.call';
257
-            if(!$xCallableObject->excluded($sMethodName))
257
+            if (!$xCallableObject->excluded($sMethodName))
258 258
             {
259 259
                 $xCallableObject->call($this->xTarget);
260 260
                 return;
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
             // Unable to find the requested class or method
264 264
             $this->throwException('', 'errors.objects.excluded', $aErrorParams);
265 265
         }
266
-        catch(ReflectionException|SetupException $e)
266
+        catch (ReflectionException|SetupException $e)
267 267
         {
268 268
             // Unable to execute the requested class or method
269 269
             $this->throwException($e->getMessage(), $sError, $aErrorParams);
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -85,8 +85,7 @@  discard block
 block discarded – undo
85 85
         if(is_string($xOptions))
86 86
         {
87 87
             $xOptions = ['include' => $xOptions];
88
-        }
89
-        elseif(!is_array($xOptions))
88
+        } elseif(!is_array($xOptions))
90 89
         {
91 90
             throw new SetupException($this->xTranslator->trans('errors.objects.invalid-declaration'));
92 91
         }
@@ -262,8 +261,7 @@  discard block
 block discarded – undo
262 261
 
263 262
             // Unable to find the requested class or method
264 263
             $this->throwException('', 'errors.objects.excluded', $aErrorParams);
265
-        }
266
-        catch(ReflectionException|SetupException $e)
264
+        } catch(ReflectionException|SetupException $e)
267 265
         {
268 266
             // Unable to execute the requested class or method
269 267
             $this->throwException($e->getMessage(), $sError, $aErrorParams);
Please login to merge, or discard this patch.
jaxon-core/src/Plugin/Request/CallableClass/ComponentOptions.php 3 patches
Spacing   +22 added lines, -24 removed lines patch added patch discarded remove patch
@@ -92,28 +92,28 @@  discard block
 block discarded – undo
92 92
     {
93 93
         $this->bExcluded = ($xMetadata?->isExcluded() ?? false) ||
94 94
             (bool)($aOptions['excluded'] ?? false);
95
-        if($this->bExcluded)
95
+        if ($this->bExcluded)
96 96
         {
97 97
             return;
98 98
         }
99 99
 
100 100
         $sSeparator = $aOptions['separator'];
101
-        if($sSeparator === '_' || $sSeparator === '.')
101
+        if ($sSeparator === '_' || $sSeparator === '.')
102 102
         {
103 103
             $this->sSeparator = $sSeparator;
104 104
         }
105 105
         $this->addProtectedMethods($aOptions['protected']);
106 106
         $this->addProtectedMethods($xMetadata?->getProtectedMethods() ?? []);
107 107
 
108
-        foreach($aOptions['functions'] as $sNames => $aFunctionOptions)
108
+        foreach ($aOptions['functions'] as $sNames => $aFunctionOptions)
109 109
         {
110 110
             $aFunctionNames = explode(',', $sNames); // Names are in comma-separated list.
111
-            foreach($aFunctionNames as $sFunctionName)
111
+            foreach ($aFunctionNames as $sFunctionName)
112 112
             {
113 113
                 $this->addFunctionOptions($sFunctionName, $aFunctionOptions);
114 114
             }
115 115
         }
116
-        foreach($xMetadata?->getProperties() ?? [] as $sFunctionName => $aFunctionOptions)
116
+        foreach ($xMetadata?->getProperties() ?? [] as $sFunctionName => $aFunctionOptions)
117 117
         {
118 118
             $this->addFunctionOptions($sFunctionName, $aFunctionOptions);
119 119
         }
@@ -126,12 +126,12 @@  discard block
 block discarded – undo
126 126
      */
127 127
     private function addProtectedMethods($xMethods): void
128 128
     {
129
-        if(!is_array($xMethods))
129
+        if (!is_array($xMethods))
130 130
         {
131 131
             $this->aProtectedMethods[trim((string)$xMethods)] = true;
132 132
             return;
133 133
         }
134
-        foreach($xMethods as $sMethod)
134
+        foreach ($xMethods as $sMethod)
135 135
         {
136 136
             $this->aProtectedMethods[trim((string)$sMethod)] = true;
137 137
         }
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
     public function isProtectedMethod(string $sMethodName, bool $bTakeAll): bool
165 165
     {
166 166
         // The public methods of the Component base classes are protected.
167
-        if(($this->xReflectionClass->isSubclassOf(NodeComponent::class) &&
167
+        if (($this->xReflectionClass->isSubclassOf(NodeComponent::class) &&
168 168
             in_array($sMethodName, ['item', 'html'])) ||
169 169
             ($this->xReflectionClass->isSubclassOf(FuncComponent::class) &&
170 170
             in_array($sMethodName, ['paginator'])))
@@ -217,17 +217,17 @@  discard block
 block discarded – undo
217 217
      */
218 218
     private function setHookMethods(array &$aHookMethods, $xValue): void
219 219
     {
220
-        foreach($xValue as $sCalledMethod => $xMethodToCall)
220
+        foreach ($xValue as $sCalledMethod => $xMethodToCall)
221 221
         {
222
-            if(!isset($aHookMethods[$sCalledMethod]))
222
+            if (!isset($aHookMethods[$sCalledMethod]))
223 223
             {
224 224
                 $aHookMethods[$sCalledMethod] = [];
225 225
             }
226
-            if(is_array($xMethodToCall))
226
+            if (is_array($xMethodToCall))
227 227
             {
228 228
                 $aHookMethods[$sCalledMethod] = array_merge($aHookMethods[$sCalledMethod], $xMethodToCall);
229 229
             }
230
-            elseif(is_string($xMethodToCall))
230
+            elseif (is_string($xMethodToCall))
231 231
             {
232 232
                 $aHookMethods[$sCalledMethod][] = $xMethodToCall;
233 233
             }
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
      */
253 253
     private function addOption(string $sName, $xValue): void
254 254
     {
255
-        switch($sName)
255
+        switch ($sName)
256 256
         {
257 257
         // Set the methods to call before processing the request
258 258
         case '__before':
@@ -280,11 +280,11 @@  discard block
 block discarded – undo
280 280
      */
281 281
     private function _addJsArrayOption(string $sFunctionName, string $sOptionName, $xOptionValue): void
282 282
     {
283
-        if(is_string($xOptionValue))
283
+        if (is_string($xOptionValue))
284 284
         {
285 285
             $xOptionValue = [$xOptionValue];
286 286
         }
287
-        if(!is_array($xOptionValue))
287
+        if (!is_array($xOptionValue))
288 288
         {
289 289
             return; // Do not save.
290 290
         }
@@ -313,10 +313,10 @@  discard block
 block discarded – undo
313 313
      */
314 314
     private function addJsOption(string $sFunctionName, string $sOptionName, $xOptionValue): void
315 315
     {
316
-        switch($sOptionName)
316
+        switch ($sOptionName)
317 317
         {
318 318
         case 'excluded':
319
-            if((bool)$xOptionValue)
319
+            if ((bool)$xOptionValue)
320 320
             {
321 321
                 $this->addProtectedMethods($sFunctionName);
322 322
             }
@@ -340,12 +340,11 @@  discard block
 block discarded – undo
340 340
      */
341 341
     private function addFunctionOptions(string $sFunctionName, array $aFunctionOptions): void
342 342
     {
343
-        foreach($aFunctionOptions as $sOptionName => $xOptionValue)
343
+        foreach ($aFunctionOptions as $sOptionName => $xOptionValue)
344 344
         {
345 345
             substr($sOptionName, 0, 2) === '__' ?
346 346
                 // Options for PHP classes. They start with "__".
347
-                $this->addOption($sOptionName, [$sFunctionName => $xOptionValue]) :
348
-                // Options for javascript code.
347
+                $this->addOption($sOptionName, [$sFunctionName => $xOptionValue]) : // Options for javascript code.
349 348
                 $this->addJsOption($sFunctionName, $sOptionName, $xOptionValue);
350 349
         }
351 350
     }
@@ -361,16 +360,15 @@  discard block
 block discarded – undo
361 360
         $aOptions = array_merge($this->aJsOptions['*'] ?? []); // Clone the array
362 361
         // Then add the method options.
363 362
         $aMethodOptions = $this->aJsOptions[$sMethodName] ?? [];
364
-        foreach($aMethodOptions as $sOptionName => $xOptionValue)
363
+        foreach ($aMethodOptions as $sOptionName => $xOptionValue)
365 364
         {
366 365
             // For databags and callbacks, merge the values in a single array.
367 366
             // For all the other options, keep the last value.
368 367
             $aOptions[$sOptionName] = !in_array($sOptionName, ['bags', 'callback']) ?
369
-                $xOptionValue :
370
-                array_unique(array_merge($aOptions[$sOptionName] ?? [], $xOptionValue));
368
+                $xOptionValue : array_unique(array_merge($aOptions[$sOptionName] ?? [], $xOptionValue));
371 369
         }
372 370
         // Since callbacks are js object names, they need a special formatting.
373
-        if(isset($aOptions['callback']))
371
+        if (isset($aOptions['callback']))
374 372
         {
375 373
             $aOptions['callback'] = str_replace('"', '', json_encode($aOptions['callback']));
376 374
         }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -226,8 +226,7 @@
 block discarded – undo
226 226
             if(is_array($xMethodToCall))
227 227
             {
228 228
                 $aHookMethods[$sCalledMethod] = array_merge($aHookMethods[$sCalledMethod], $xMethodToCall);
229
-            }
230
-            elseif(is_string($xMethodToCall))
229
+            } elseif(is_string($xMethodToCall))
231 230
             {
232 231
                 $aHookMethods[$sCalledMethod][] = $xMethodToCall;
233 232
             }
Please login to merge, or discard this patch.
Switch Indentation   +145 added lines, -145 removed lines patch added patch discarded remove patch
@@ -31,183 +31,183 @@  discard block
 block discarded – undo
31 31
 
32 32
 class ComponentOptions
33 33
 {
34
-    /**
34
+/**
35 35
      * Check if the js code for this object must be generated
36 36
      *
37 37
      * @var bool
38 38
      */
39
-    private $bExcluded = false;
39
+private $bExcluded = false;
40 40
 
41
-    /**
41
+/**
42 42
      * The character to use as separator in javascript class names
43 43
      *
44 44
      * @var string
45 45
      */
46
-    private $sSeparator = '.';
46
+private $sSeparator = '.';
47 47
 
48
-    /**
48
+/**
49 49
      * A list of methods of the user registered callable object the library must not export to javascript
50 50
      *
51 51
      * @var array
52 52
      */
53
-    private $aProtectedMethods = [];
53
+private $aProtectedMethods = [];
54 54
 
55
-    /**
55
+/**
56 56
      * A list of methods to call before processing the request
57 57
      *
58 58
      * @var array
59 59
      */
60
-    private $aBeforeMethods = [];
60
+private $aBeforeMethods = [];
61 61
 
62
-    /**
62
+/**
63 63
      * A list of methods to call after processing the request
64 64
      *
65 65
      * @var array
66 66
      */
67
-    private $aAfterMethods = [];
67
+private $aAfterMethods = [];
68 68
 
69
-    /**
69
+/**
70 70
      * The javascript class options
71 71
      *
72 72
      * @var array
73 73
      */
74
-    private $aJsOptions = [];
74
+private $aJsOptions = [];
75 75
 
76
-    /**
76
+/**
77 77
      * The DI options
78 78
      *
79 79
      * @var array
80 80
      */
81
-    private $aDiOptions = [];
81
+private $aDiOptions = [];
82 82
 
83
-    /**
83
+/**
84 84
      * The constructor
85 85
      *
86 86
      * @param ReflectionClass $xReflectionClass
87 87
      * @param array $aOptions
88 88
      * @param MetadataInterface|null $xMetadata
89 89
      */
90
-    public function __construct(private ReflectionClass $xReflectionClass,
91
-        array $aOptions, ?MetadataInterface $xMetadata)
92
-    {
93
-        $this->bExcluded = ($xMetadata?->isExcluded() ?? false) ||
94
-            (bool)($aOptions['excluded'] ?? false);
95
-        if($this->bExcluded)
96
-        {
97
-            return;
98
-        }
90
+public function __construct(private ReflectionClass $xReflectionClass,
91
+array $aOptions, ?MetadataInterface $xMetadata)
92
+{
93
+$this->bExcluded = ($xMetadata?->isExcluded() ?? false) ||
94
+(bool)($aOptions['excluded'] ?? false);
95
+if($this->bExcluded)
96
+{
97
+return;
98
+}
99 99
 
100
-        $sSeparator = $aOptions['separator'];
101
-        if($sSeparator === '_' || $sSeparator === '.')
102
-        {
103
-            $this->sSeparator = $sSeparator;
104
-        }
105
-        $this->addProtectedMethods($aOptions['protected']);
106
-        $this->addProtectedMethods($xMetadata?->getProtectedMethods() ?? []);
100
+$sSeparator = $aOptions['separator'];
101
+if($sSeparator === '_' || $sSeparator === '.')
102
+{
103
+$this->sSeparator = $sSeparator;
104
+}
105
+$this->addProtectedMethods($aOptions['protected']);
106
+$this->addProtectedMethods($xMetadata?->getProtectedMethods() ?? []);
107 107
 
108
-        foreach($aOptions['functions'] as $sNames => $aFunctionOptions)
109
-        {
110
-            $aFunctionNames = explode(',', $sNames); // Names are in comma-separated list.
111
-            foreach($aFunctionNames as $sFunctionName)
112
-            {
113
-                $this->addFunctionOptions($sFunctionName, $aFunctionOptions);
114
-            }
115
-        }
116
-        foreach($xMetadata?->getProperties() ?? [] as $sFunctionName => $aFunctionOptions)
117
-        {
118
-            $this->addFunctionOptions($sFunctionName, $aFunctionOptions);
119
-        }
120
-    }
108
+foreach($aOptions['functions'] as $sNames => $aFunctionOptions)
109
+{
110
+$aFunctionNames = explode(',', $sNames); // Names are in comma-separated list.
111
+foreach($aFunctionNames as $sFunctionName)
112
+{
113
+    $this->addFunctionOptions($sFunctionName, $aFunctionOptions);
114
+}
115
+}
116
+foreach($xMetadata?->getProperties() ?? [] as $sFunctionName => $aFunctionOptions)
117
+{
118
+$this->addFunctionOptions($sFunctionName, $aFunctionOptions);
119
+}
120
+}
121 121
 
122
-    /**
122
+/**
123 123
      * @param mixed $xMethods
124 124
      *
125 125
      * @return void
126 126
      */
127
-    private function addProtectedMethods($xMethods): void
128
-    {
129
-        if(!is_array($xMethods))
130
-        {
131
-            $this->aProtectedMethods[trim((string)$xMethods)] = true;
132
-            return;
133
-        }
134
-        foreach($xMethods as $sMethod)
135
-        {
136
-            $this->aProtectedMethods[trim((string)$sMethod)] = true;
137
-        }
138
-    }
127
+private function addProtectedMethods($xMethods): void
128
+{
129
+if(!is_array($xMethods))
130
+{
131
+$this->aProtectedMethods[trim((string)$xMethods)] = true;
132
+return;
133
+}
134
+foreach($xMethods as $sMethod)
135
+{
136
+$this->aProtectedMethods[trim((string)$sMethod)] = true;
137
+}
138
+}
139 139
 
140
-    /**
140
+/**
141 141
      * Check if the js code for this object must be generated
142 142
      *
143 143
      * @return bool
144 144
      */
145
-    public function excluded(): bool
146
-    {
147
-        return $this->bExcluded;
148
-    }
145
+public function excluded(): bool
146
+{
147
+return $this->bExcluded;
148
+}
149 149
 
150
-    /**
150
+/**
151 151
      * @return string
152 152
      */
153
-    public function separator(): string
154
-    {
155
-        return $this->sSeparator;
156
-    }
153
+public function separator(): string
154
+{
155
+return $this->sSeparator;
156
+}
157 157
 
158
-    /**
158
+/**
159 159
      * @param string $sMethodName
160 160
      * @param bool $bTakeAll
161 161
      *
162 162
      * @return bool
163 163
      */
164
-    public function isProtectedMethod(string $sMethodName, bool $bTakeAll): bool
165
-    {
166
-        // The public methods of the Component base classes are protected.
167
-        if(($this->xReflectionClass->isSubclassOf(NodeComponent::class) &&
168
-            in_array($sMethodName, ['item', 'html'])) ||
169
-            ($this->xReflectionClass->isSubclassOf(FuncComponent::class) &&
170
-            in_array($sMethodName, ['paginator'])))
171
-        {
172
-            return true;
173
-        }
174
-        return !$bTakeAll && (isset($this->aProtectedMethods['*'])
175
-            || isset($this->aProtectedMethods[$sMethodName]));
176
-    }
164
+public function isProtectedMethod(string $sMethodName, bool $bTakeAll): bool
165
+{
166
+// The public methods of the Component base classes are protected.
167
+if(($this->xReflectionClass->isSubclassOf(NodeComponent::class) &&
168
+in_array($sMethodName, ['item', 'html'])) ||
169
+($this->xReflectionClass->isSubclassOf(FuncComponent::class) &&
170
+in_array($sMethodName, ['paginator'])))
171
+{
172
+return true;
173
+}
174
+return !$bTakeAll && (isset($this->aProtectedMethods['*'])
175
+|| isset($this->aProtectedMethods[$sMethodName]));
176
+}
177 177
 
178
-    /**
178
+/**
179 179
      * @return array
180 180
      */
181
-    public function beforeMethods(): array
182
-    {
183
-        return $this->aBeforeMethods;
184
-    }
181
+public function beforeMethods(): array
182
+{
183
+return $this->aBeforeMethods;
184
+}
185 185
 
186
-    /**
186
+/**
187 187
      * @return array
188 188
      */
189
-    public function afterMethods(): array
190
-    {
191
-        return $this->aAfterMethods;
192
-    }
189
+public function afterMethods(): array
190
+{
191
+return $this->aAfterMethods;
192
+}
193 193
 
194
-    /**
194
+/**
195 195
      * @return array
196 196
      */
197
-    public function diOptions(): array
198
-    {
199
-        return $this->aDiOptions;
200
-    }
197
+public function diOptions(): array
198
+{
199
+return $this->aDiOptions;
200
+}
201 201
 
202
-    /**
202
+/**
203 203
      * @return array
204 204
      */
205
-    public function jsOptions(): array
206
-    {
207
-        return $this->aJsOptions;
208
-    }
205
+public function jsOptions(): array
206
+{
207
+return $this->aJsOptions;
208
+}
209 209
 
210
-    /**
210
+/**
211 211
      * Set hook methods
212 212
      *
213 213
      * @param array $aHookMethods    The array of hook methods
@@ -215,34 +215,34 @@  discard block
 block discarded – undo
215 215
      *
216 216
      * @return void
217 217
      */
218
-    private function setHookMethods(array &$aHookMethods, $xValue): void
219
-    {
220
-        foreach($xValue as $sCalledMethod => $xMethodToCall)
221
-        {
222
-            if(!isset($aHookMethods[$sCalledMethod]))
223
-            {
224
-                $aHookMethods[$sCalledMethod] = [];
225
-            }
226
-            if(is_array($xMethodToCall))
227
-            {
228
-                $aHookMethods[$sCalledMethod] = array_merge($aHookMethods[$sCalledMethod], $xMethodToCall);
229
-            }
230
-            elseif(is_string($xMethodToCall))
231
-            {
232
-                $aHookMethods[$sCalledMethod][] = $xMethodToCall;
233
-            }
234
-        }
235
-    }
218
+private function setHookMethods(array &$aHookMethods, $xValue): void
219
+{
220
+foreach($xValue as $sCalledMethod => $xMethodToCall)
221
+{
222
+if(!isset($aHookMethods[$sCalledMethod]))
223
+{
224
+    $aHookMethods[$sCalledMethod] = [];
225
+}
226
+if(is_array($xMethodToCall))
227
+{
228
+    $aHookMethods[$sCalledMethod] = array_merge($aHookMethods[$sCalledMethod], $xMethodToCall);
229
+}
230
+elseif(is_string($xMethodToCall))
231
+{
232
+    $aHookMethods[$sCalledMethod][] = $xMethodToCall;
233
+}
234
+}
235
+}
236 236
 
237
-    /**
237
+/**
238 238
      * @param array $aDiOptions
239 239
      */
240
-    private function addDiOption(array $aDiOptions): void
241
-    {
242
-        $this->aDiOptions = array_merge($this->aDiOptions, $aDiOptions);
243
-    }
240
+private function addDiOption(array $aDiOptions): void
241
+{
242
+$this->aDiOptions = array_merge($this->aDiOptions, $aDiOptions);
243
+}
244 244
 
245
-    /**
245
+/**
246 246
      * Set configuration options / call options for each method
247 247
      *
248 248
      * @param string $sName    The name of the configuration option
@@ -250,25 +250,25 @@  discard block
 block discarded – undo
250 250
      *
251 251
      * @return void
252 252
      */
253
-    private function addOption(string $sName, $xValue): void
254
-    {
255
-        switch($sName)
256
-        {
257
-        // Set the methods to call before processing the request
258
-        case '__before':
259
-            $this->setHookMethods($this->aBeforeMethods, $xValue);
260
-            break;
261
-        // Set the methods to call after processing the request
262
-        case '__after':
263
-            $this->setHookMethods($this->aAfterMethods, $xValue);
264
-            break;
265
-        // Set the attributes to inject in the callable object
266
-        case '__di':
267
-            $this->addDiOption($xValue);
268
-            break;
269
-        default:
270
-            break;
271
-        }
253
+private function addOption(string $sName, $xValue): void
254
+{
255
+switch($sName)
256
+{
257
+// Set the methods to call before processing the request
258
+case '__before':
259
+$this->setHookMethods($this->aBeforeMethods, $xValue);
260
+break;
261
+// Set the methods to call after processing the request
262
+case '__after':
263
+$this->setHookMethods($this->aAfterMethods, $xValue);
264
+break;
265
+// Set the attributes to inject in the callable object
266
+case '__di':
267
+$this->addDiOption($xValue);
268
+break;
269
+default:
270
+break;
271
+}
272 272
     }
273 273
 
274 274
     /**
Please login to merge, or discard this patch.
jaxon-core/src/Plugin/Request/CallableClass/ComponentRegistry.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
     public function __construct(protected ComponentContainer $cdi)
112 112
     {
113 113
         // Set the composer autoloader
114
-        if(file_exists(($sAutoloadFile = __DIR__ . '/../../../../../../autoload.php')) ||
114
+        if (file_exists(($sAutoloadFile = __DIR__ . '/../../../../../../autoload.php')) ||
115 115
             file_exists(($sAutoloadFile = __DIR__ . '/../../../../../vendor/autoload.php')) ||
116 116
             file_exists(($sAutoloadFile = __DIR__ . '/../../../../vendor/autoload.php')))
117 117
         {
@@ -180,15 +180,15 @@  discard block
 block discarded – undo
180 180
      */
181 181
     private function makeClassOptions(string $sClassName, array $aClassOptions, array $aDirectoryOptions): array
182 182
     {
183
-        foreach($this->aDefaultClassOptions as $sOption => $xValue)
183
+        foreach ($this->aDefaultClassOptions as $sOption => $xValue)
184 184
         {
185
-            if(!isset($aClassOptions[$sOption]))
185
+            if (!isset($aClassOptions[$sOption]))
186 186
             {
187 187
                 $aClassOptions[$sOption] = $xValue;
188 188
             }
189 189
         }
190 190
         $aClassOptions['excluded'] = (bool)($aClassOptions['excluded'] ?? false); // Convert to bool.
191
-        if(is_string($aClassOptions['protected']))
191
+        if (is_string($aClassOptions['protected']))
192 192
         {
193 193
             $aClassOptions['protected'] = [$aClassOptions['protected']]; // Convert to array.
194 194
         }
@@ -199,30 +199,30 @@  discard block
 block discarded – undo
199 199
             $aDirectoryOptions['classes']['*'] ?? [], // Options for all classes
200 200
             $aDirectoryOptions['classes'][$sClassName] ?? [], // Options for this specific class
201 201
         ];
202
-        foreach($aOptionGroups as $aOptionGroup)
202
+        foreach ($aOptionGroups as $aOptionGroup)
203 203
         {
204
-            if(isset($aOptionGroup['separator']))
204
+            if (isset($aOptionGroup['separator']))
205 205
             {
206 206
                 $aClassOptions['separator'] = (string)$aOptionGroup['separator'];
207 207
             }
208
-            if(isset($aOptionGroup['excluded']))
208
+            if (isset($aOptionGroup['excluded']))
209 209
             {
210 210
                 $aClassOptions['excluded'] = (bool)$aOptionGroup['excluded'];
211 211
             }
212
-            if(isset($aOptionGroup['protected']))
212
+            if (isset($aOptionGroup['protected']))
213 213
             {
214
-                if(is_string($aOptionGroup['protected']))
214
+                if (is_string($aOptionGroup['protected']))
215 215
                 {
216 216
                     $aOptionGroup['protected'] = [$aOptionGroup['protected']]; // Convert to array.
217 217
                 }
218 218
                 $aClassOptions['protected'] = array_merge($aClassOptions['protected'], $aOptionGroup['protected']);
219 219
             }
220
-            if(isset($aOptionGroup['functions']))
220
+            if (isset($aOptionGroup['functions']))
221 221
             {
222 222
                 $aClassOptions['functions'] = array_merge($aClassOptions['functions'], $aOptionGroup['functions']);
223 223
             }
224 224
         }
225
-        if(isset($aDirectoryOptions['config']) && !isset($aClassOptions['config']))
225
+        if (isset($aDirectoryOptions['config']) && !isset($aClassOptions['config']))
226 226
         {
227 227
             $aClassOptions['config'] = $aDirectoryOptions['config'];
228 228
         }
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
     {
245 245
         $aOptions = $this->makeClassOptions($sClassName, $aClassOptions, $aDirectoryOptions);
246 246
         $this->cdi->registerComponent($sClassName, $aOptions);
247
-        if($this->bUpdateHash)
247
+        if ($this->bUpdateHash)
248 248
         {
249 249
             $this->sHash .= $sClassName . $aOptions['timestamp'];
250 250
         }
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
      */
261 261
     public function registerComponent(string $sClassName, array $aClassOptions): void
262 262
     {
263
-        if($this->xPackageConfig !== null)
263
+        if ($this->xPackageConfig !== null)
264 264
         {
265 265
             $aClassOptions['config'] = $this->xPackageConfig;
266 266
         }
@@ -277,10 +277,10 @@  discard block
 block discarded – undo
277 277
     public function getNamespaceComponentOptions(string $sClassName): ?array
278 278
     {
279 279
         // Find the corresponding namespace
280
-        foreach($this->aNamespaceOptions as $sNamespace => $aDirectoryOptions)
280
+        foreach ($this->aNamespaceOptions as $sNamespace => $aDirectoryOptions)
281 281
         {
282 282
             // Check if the namespace matches the class.
283
-            if(strncmp($sClassName, $sNamespace . '\\', strlen($sNamespace) + 1) === 0)
283
+            if (strncmp($sClassName, $sNamespace . '\\', strlen($sNamespace) + 1) === 0)
284 284
             {
285 285
                 // Save the class options
286 286
                 $aClassOptions = ['namespace' => $sNamespace];
@@ -301,11 +301,11 @@  discard block
 block discarded – undo
301 301
     public function registerDirectory(string $sDirectory, array $aOptions): void
302 302
     {
303 303
         // Set the autoload option default value
304
-        if(!isset($aOptions['autoload']))
304
+        if (!isset($aOptions['autoload']))
305 305
         {
306 306
             $aOptions['autoload'] = true;
307 307
         }
308
-        if($this->xPackageConfig !== null)
308
+        if ($this->xPackageConfig !== null)
309 309
         {
310 310
             $aOptions['config'] = $this->xPackageConfig;
311 311
         }
@@ -337,30 +337,30 @@  discard block
 block discarded – undo
337 337
     public function registerNamespace(string $sNamespace, array $aOptions): void
338 338
     {
339 339
         // Separator default value
340
-        if(!isset($aOptions['separator']))
340
+        if (!isset($aOptions['separator']))
341 341
         {
342 342
             $aOptions['separator'] = '.';
343 343
         }
344 344
         $aOptions['separator'] = trim($aOptions['separator']);
345
-        if(!in_array($aOptions['separator'], ['.', '_']))
345
+        if (!in_array($aOptions['separator'], ['.', '_']))
346 346
         {
347 347
             $aOptions['separator'] = '.';
348 348
         }
349
-        if($aOptions['separator'] === '_')
349
+        if ($aOptions['separator'] === '_')
350 350
         {
351 351
             $this->cdi->useUnderscore();
352 352
         }
353 353
         // Set the autoload option default value
354
-        if(!isset($aOptions['autoload']))
354
+        if (!isset($aOptions['autoload']))
355 355
         {
356 356
             $aOptions['autoload'] = true;
357 357
         }
358
-        if($this->xPackageConfig !== null)
358
+        if ($this->xPackageConfig !== null)
359 359
         {
360 360
             $aOptions['config'] = $this->xPackageConfig;
361 361
         }
362 362
         // Register the dir with PSR4 autoloading
363
-        if(($aOptions['autoload']) && $this->xAutoloader != null)
363
+        if (($aOptions['autoload']) && $this->xAutoloader != null)
364 364
         {
365 365
             $this->xAutoloader->setPsr4($sNamespace . '\\', $aOptions['directory']);
366 366
         }
@@ -376,28 +376,28 @@  discard block
 block discarded – undo
376 376
     public function registerComponentsInDirectories(): void
377 377
     {
378 378
         // This is to be done only once.
379
-        if($this->bDirectoriesParsed)
379
+        if ($this->bDirectoriesParsed)
380 380
         {
381 381
             return;
382 382
         }
383 383
         $this->bDirectoriesParsed = true;
384 384
 
385 385
         // Browse directories without namespaces and read all the files.
386
-        foreach($this->aDirectoryOptions as $sDirectory => $aDirectoryOptions)
386
+        foreach ($this->aDirectoryOptions as $sDirectory => $aDirectoryOptions)
387 387
         {
388 388
             $itFile = new SortedFileIterator($sDirectory);
389 389
             // Iterate on dir content
390
-            foreach($itFile as $xFile)
390
+            foreach ($itFile as $xFile)
391 391
             {
392 392
                 // Skip everything except PHP files
393
-                if(!$xFile->isFile() || $xFile->getExtension() !== 'php')
393
+                if (!$xFile->isFile() || $xFile->getExtension() !== 'php')
394 394
                 {
395 395
                     continue;
396 396
                 }
397 397
 
398 398
                 $sClassName = $xFile->getBasename('.php');
399 399
                 $aClassOptions = ['timestamp' => $xFile->getMTime()];
400
-                if(($aDirectoryOptions['autoload']) && $this->xAutoloader !== null)
400
+                if (($aDirectoryOptions['autoload']) && $this->xAutoloader !== null)
401 401
                 {
402 402
                     // Set classmap autoloading. Must be done before registering the class.
403 403
                     $this->xAutoloader->addClassMap([$sClassName => $xFile->getPathname()]);
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
     public function registerComponentsInNamespaces(): void
416 416
     {
417 417
         // This is to be done only once.
418
-        if($this->bNamespacesParsed)
418
+        if ($this->bNamespacesParsed)
419 419
         {
420 420
             return;
421 421
         }
@@ -423,17 +423,17 @@  discard block
 block discarded – undo
423 423
 
424 424
         // Browse directories with namespaces and read all the files.
425 425
         $sDS = DIRECTORY_SEPARATOR;
426
-        foreach($this->aNamespaceOptions as $sNamespace => $aDirectoryOptions)
426
+        foreach ($this->aNamespaceOptions as $sNamespace => $aDirectoryOptions)
427 427
         {
428 428
             $this->addNamespace($sNamespace, ['separator' => $aDirectoryOptions['separator']]);
429 429
 
430 430
             // Iterate on dir content
431 431
             $sDirectory = $aDirectoryOptions['directory'];
432 432
             $itFile = new SortedFileIterator($sDirectory);
433
-            foreach($itFile as $xFile)
433
+            foreach ($itFile as $xFile)
434 434
             {
435 435
                 // skip everything except PHP files
436
-                if(!$xFile->isFile() || $xFile->getExtension() !== 'php')
436
+                if (!$xFile->isFile() || $xFile->getExtension() !== 'php')
437 437
                 {
438 438
                     continue;
439 439
                 }
@@ -442,7 +442,7 @@  discard block
 block discarded – undo
442 442
                 $sClassPath = $sNamespace;
443 443
                 $sRelativePath = substr($xFile->getPath(), strlen($sDirectory));
444 444
                 $sRelativePath = trim(str_replace($sDS, '\\', $sRelativePath), '\\');
445
-                if($sRelativePath !== '')
445
+                if ($sRelativePath !== '')
446 446
                 {
447 447
                     $sClassPath .= '\\' . $sRelativePath;
448 448
                 }
Please login to merge, or discard this patch.
jaxon-core/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.
jaxon-core/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;
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
     public function register(string $sType, string $sCallable, array $aOptions): bool
115 115
     {
116 116
         // The $sCallable var is not used here because the checkOptions() method copied it into the $aOptions array.
117
-        if(($aOptions['namespace']))
117
+        if (($aOptions['namespace']))
118 118
         {
119 119
             $this->xRegistry->registerNamespace($aOptions['namespace'], $aOptions);
120 120
             return true;
Please login to merge, or discard this patch.
jaxon-core/src/Plugin/Request/CallableClass/CallableObject.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
     /**
73 73
      * @var int
74 74
      */
75
-    private $nPropertiesFilter = ReflectionProperty::IS_PUBLIC | ReflectionProperty::IS_PROTECTED;
75
+    private $nPropertiesFilter = ReflectionProperty::IS_PUBLIC|ReflectionProperty::IS_PROTECTED;
76 76
 
77 77
     /**
78 78
      * @var int
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
     {
105 105
         /** @var Config|null */
106 106
         $xConfig = $aOptions['config'] ?? null;
107
-        if($xConfig === null)
107
+        if ($xConfig === null)
108 108
         {
109 109
             return null;
110 110
         }
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
      */
166 166
     public function excluded(?string $sMethod = null): bool
167 167
     {
168
-        if($sMethod !== null && $this->isProtectedMethod($sMethod, false))
168
+        if ($sMethod !== null && $this->isProtectedMethod($sMethod, false))
169 169
         {
170 170
             return true;
171 171
         }
@@ -267,11 +267,11 @@  discard block
 block discarded – undo
267 267
         $sMethod = $this->xTarget->getMethodName();
268 268
         // The hooks defined at method level are merged with those defined at class level.
269 269
         $aMethods = array_merge($aHookMethods['*'] ?? [], $aHookMethods[$sMethod] ?? []);
270
-        foreach($aMethods as $xKey => $xValue)
270
+        foreach ($aMethods as $xKey => $xValue)
271 271
         {
272 272
             $sHookName = $xValue;
273 273
             $aHookArgs = [];
274
-            if(is_string($xKey))
274
+            if (is_string($xKey))
275 275
             {
276 276
                 $sHookName = $xKey;
277 277
                 $aHookArgs = is_array($xValue) ? $xValue : [$xValue];
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
             // Warning: dynamic properties will be deprecated in PHP8.2.
310 310
             $this->$sAttr = $xDiValue;
311 311
         };
312
-        foreach($aDiOptions as $sAttr => $sClass)
312
+        foreach ($aDiOptions as $sAttr => $sClass)
313 313
         {
314 314
             $this->setDiAttribute($xComponent, $sAttr, $this->di->get($sClass), $cSetter);
315 315
         }
Please login to merge, or discard this patch.
jaxon-core/src/Plugin/Request/CallableFunction/CallableFunction.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
      */
105 105
     public function configure(string $sName, string $sValue): void
106 106
     {
107
-        switch($sName)
107
+        switch ($sName)
108 108
         {
109 109
         case 'class': // The user function is a method in the given class
110 110
             $this->xPhpFunction = [$sValue, $this->xPhpFunction];
@@ -128,12 +128,12 @@  discard block
 block discarded – undo
128 128
      */
129 129
     public function call(array $aArgs = []): void
130 130
     {
131
-        if($this->sInclude !== '')
131
+        if ($this->sInclude !== '')
132 132
         {
133 133
             require_once $this->sInclude;
134 134
         }
135 135
         // If the function is an alias for a class method, then instantiate the class
136
-        if(is_array($this->xPhpFunction) && is_string($this->xPhpFunction[0]))
136
+        if (is_array($this->xPhpFunction) && is_string($this->xPhpFunction[0]))
137 137
         {
138 138
             $sClassName = $this->xPhpFunction[0];
139 139
             $this->xPhpFunction[0] = $this->di->h($sClassName) ?
Please login to merge, or discard this patch.