Passed
Push — main ( 99eb4f...cf0b02 )
by Thierry
04:07
created
jaxon-annotations/src/register.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
 function register(): void
31 31
 {
32 32
     // Do nothing if running in cli.
33
-    if(php_sapi_name() !== 'cli')
33
+    if (php_sapi_name() !== 'cli')
34 34
     {
35 35
         _register();
36 36
     };
Please login to merge, or discard this patch.
jaxon-flot/src/register.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
 function register(): void
31 31
 {
32 32
     // Do nothing if running in cli.
33
-    if(php_sapi_name() !== 'cli')
33
+    if (php_sapi_name() !== 'cli')
34 34
     {
35 35
         _register();
36 36
     };
Please login to merge, or discard this patch.
jaxon-core/src/App/Metadata/Metadata.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -139,16 +139,16 @@  discard block
 block discarded – undo
139 139
     {
140 140
         $aProperties = [];
141 141
         $aClassProperties = [];
142
-        foreach($this->aAttributes as $sType => $aValues)
142
+        foreach ($this->aAttributes as $sType => $aValues)
143 143
         {
144
-            if($sType === 'exclude')
144
+            if ($sType === 'exclude')
145 145
             {
146 146
                 continue;
147 147
             }
148 148
 
149
-            foreach($aValues as $sMethod => $xData)
149
+            foreach ($aValues as $sMethod => $xData)
150 150
             {
151
-                if($sMethod === '*')
151
+                if ($sMethod === '*')
152 152
                 {
153 153
                     $aClassProperties[$xData->getName()] = $xData->getValue();
154 154
                     continue;
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
             }
158 158
         }
159 159
 
160
-        if(count($aClassProperties) > 0)
160
+        if (count($aClassProperties) > 0)
161 161
         {
162 162
             $aProperties['*'] = $aClassProperties;
163 163
         }
Please login to merge, or discard this patch.
jaxon-core/src/Plugin/Request/CallableClass/CallableObject.php 1 patch
Spacing   +4 added lines, -5 removed lines patch added patch discarded remove patch
@@ -75,8 +75,7 @@  discard block
 block discarded – undo
75 75
      */
76 76
     public function excluded(?string $sMethodName = null): bool
77 77
     {
78
-        return $sMethodName === null ? $this->xOptions->excluded() :
79
-            $this->xOptions->isProtectedMethod($sMethodName);
78
+        return $sMethodName === null ? $this->xOptions->excluded() : $this->xOptions->isProtectedMethod($sMethodName);
80 79
     }
81 80
 
82 81
     /**
@@ -176,11 +175,11 @@  discard block
 block discarded – undo
176 175
         $sMethod = $this->xTarget->getMethodName();
177 176
         // The hooks defined at method level are merged with those defined at class level.
178 177
         $aMethods = array_merge($aHookMethods['*'] ?? [], $aHookMethods[$sMethod] ?? []);
179
-        foreach($aMethods as $xKey => $xValue)
178
+        foreach ($aMethods as $xKey => $xValue)
180 179
         {
181 180
             $sHookName = $xValue;
182 181
             $aHookArgs = [];
183
-            if(is_string($xKey))
182
+            if (is_string($xKey))
184 183
             {
185 184
                 $sHookName = $xKey;
186 185
                 $aHookArgs = is_array($xValue) ? $xValue : [$xValue];
@@ -218,7 +217,7 @@  discard block
 block discarded – undo
218 217
             // Warning: dynamic properties will be deprecated in PHP8.2.
219 218
             $this->$sAttr = $xDiValue;
220 219
         };
221
-        foreach($aDiOptions as $sAttr => $sClass)
220
+        foreach ($aDiOptions as $sAttr => $sClass)
222 221
         {
223 222
             $this->setDiAttribute($xComponent, $sAttr, $this->di->get($sClass), $cSetter);
224 223
         }
Please login to merge, or discard this patch.
jaxon-core/src/Script/CallFactory.php 1 patch
Spacing   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -50,8 +50,7 @@
 block discarded – undo
50 50
     public function rq(string $sClassName = ''): ?JxnCall
51 51
     {
52 52
         $sClassName = trim($sClassName);
53
-        return $sClassName === '' ? $this->cdi->getFunctionRequestFactory() :
54
-            $this->cdi->getComponentRequestFactory($sClassName);
53
+        return $sClassName === '' ? $this->cdi->getFunctionRequestFactory() : $this->cdi->getComponentRequestFactory($sClassName);
55 54
     }
56 55
 
57 56
     /**
Please login to merge, or discard this patch.
jaxon-core/src/Di/Traits/ComponentTrait.php 1 patch
Spacing   +12 added lines, -13 removed lines patch added patch discarded remove patch
@@ -136,12 +136,12 @@  discard block
 block discarded – undo
136 136
      */
137 137
     private function discoverComponent(string $sClassName)
138 138
     {
139
-        if(!isset($this->aComponents[$sClassName]))
139
+        if (!isset($this->aComponents[$sClassName]))
140 140
         {
141 141
             $xRegistry = $this->cn()->g(ComponentRegistry::class);
142 142
             $xRegistry->updateHash(false); // Disable hash calculation.
143 143
             $aOptions = $xRegistry->getNamespaceComponentOptions($sClassName);
144
-            if($aOptions !== null)
144
+            if ($aOptions !== null)
145 145
             {
146 146
                 $this->registerComponent($sClassName, $aOptions);
147 147
             }
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
                 $xRegistry->registerComponentsInDirectories();
153 153
             }
154 154
         }
155
-        if(!isset($this->aComponents[$sClassName]))
155
+        if (!isset($this->aComponents[$sClassName]))
156 156
         {
157 157
             throw new SetupException($this->cn()->g(Translator::class)
158 158
                 ->trans('errors.class.invalid', ['name' => $sClassName]));
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
     public function getCallableObjects(): array
169 169
     {
170 170
         $aCallableObjects = [];
171
-        foreach($this->aComponents as $sClassName => $_)
171
+        foreach ($this->aComponents as $sClassName => $_)
172 172
         {
173 173
             $aCallableObjects[$sClassName] = $this->makeCallableObject($sClassName);
174 174
         }
@@ -219,12 +219,12 @@  discard block
 block discarded – undo
219 219
     {
220 220
         /** @var Config|null */
221 221
         $xPackageConfig = $aOptions['config'] ?? null;
222
-        if($xPackageConfig === null || (bool)($aOptions['excluded'] ?? false))
222
+        if ($xPackageConfig === null || (bool)($aOptions['excluded'] ?? false))
223 223
         {
224 224
             return null;
225 225
         }
226 226
         $sReaderId = $xPackageConfig->getOption('metadata.reader');
227
-        if(!in_array($sReaderId, ['attributes', 'annotations']))
227
+        if (!in_array($sReaderId, ['attributes', 'annotations']))
228 228
         {
229 229
             return null;
230 230
         }
@@ -234,23 +234,23 @@  discard block
 block discarded – undo
234 234
         $xMetadata = null;
235 235
         $xMetadataCache = null;
236 236
         $xConfig = $di->config();
237
-        if($xConfig->getAppOption('metadata.cache.enabled', false))
237
+        if ($xConfig->getAppOption('metadata.cache.enabled', false))
238 238
         {
239
-            if(!$di->h('jaxon_metadata_cache_dir'))
239
+            if (!$di->h('jaxon_metadata_cache_dir'))
240 240
             {
241 241
                 $sCacheDir = $xConfig->getAppOption('metadata.cache.dir');
242 242
                 $di->val('jaxon_metadata_cache_dir', $sCacheDir);
243 243
             }
244 244
             $xMetadataCache = $di->getMetadataCache();
245 245
             $xMetadata = $xMetadataCache->read($xReflectionClass->getName());
246
-            if($xMetadata !== null)
246
+            if ($xMetadata !== null)
247 247
             {
248 248
                 return $xMetadata;
249 249
             }
250 250
         }
251 251
 
252 252
         $aProperties = array_map(fn($xProperty) => $xProperty->getName(),
253
-            $xReflectionClass->getProperties(ReflectionProperty::IS_PUBLIC |
253
+            $xReflectionClass->getProperties(ReflectionProperty::IS_PUBLIC|
254 254
                 ReflectionProperty::IS_PROTECTED));
255 255
         $aMethods = $this->getPublicMethods($xReflectionClass);
256 256
 
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
         $xMetadata = $xMetadataReader->getAttributes($xInput);
260 260
 
261 261
         // Try to save the metadata in the cache
262
-        if($xMetadataCache !== null && $xMetadata !== null)
262
+        if ($xMetadataCache !== null && $xMetadata !== null)
263 263
         {
264 264
             $xMetadataCache->save($xReflectionClass->getName(), $xMetadata);
265 265
         }
@@ -277,8 +277,7 @@  discard block
 block discarded – undo
277 277
         array $aOptions): ComponentOptions
278 278
     {
279 279
         $xMetadata = $this->getComponentMetadata($xReflectionClass, $aOptions);
280
-        return !$xMetadata ? new ComponentOptions($aOptions) :
281
-            new ComponentOptions($aOptions, $xMetadata->isExcluded(),
280
+        return !$xMetadata ? new ComponentOptions($aOptions) : new ComponentOptions($aOptions, $xMetadata->isExcluded(),
282 281
             $xMetadata->getProtectedMethods(), $xMetadata->getProperties());
283 282
     }
284 283
 }
Please login to merge, or discard this patch.
jaxon-core/src/Di/ComponentContainer.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -186,13 +186,13 @@  discard block
 block discarded – undo
186 186
         try
187 187
         {
188 188
             // Make sure the registered class exists
189
-            if(isset($aOptions['include']))
189
+            if (isset($aOptions['include']))
190 190
             {
191 191
                 require_once $aOptions['include'];
192 192
             }
193 193
             $xReflectionClass = new ReflectionClass($sClassName);
194 194
             // Check if the class is registrable
195
-            if(!$xReflectionClass->isInstantiable())
195
+            if (!$xReflectionClass->isInstantiable())
196 196
             {
197 197
                 return;
198 198
             }
@@ -200,14 +200,14 @@  discard block
 block discarded – undo
200 200
             $this->_saveClassOptions($sClassName, $aOptions);
201 201
             $this->val($this->getReflectionClassKey($sClassName), $xReflectionClass);
202 202
             // Register the user class, but only if the user didn't already.
203
-            if(!$this->has($sClassName))
203
+            if (!$this->has($sClassName))
204 204
             {
205 205
                 $this->set($sClassName, function() use($sClassName) {
206 206
                     return $this->make($this->get($this->getReflectionClassKey($sClassName)));
207 207
                 });
208 208
             }
209 209
         }
210
-        catch(ReflectionException $e)
210
+        catch (ReflectionException $e)
211 211
         {
212 212
             throw new SetupException($this->cn()->g(Translator::class)
213 213
                 ->trans('errors.class.invalid', ['name' => $sClassName]));
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
     {
227 227
         $sComponentObject = $this->getCallableObjectKey($sClassName);
228 228
         // Prevent duplication. It's important not to use the class name here.
229
-        if($this->has($sComponentObject))
229
+        if ($this->has($sComponentObject))
230 230
         {
231 231
             return;
232 232
         }
@@ -252,14 +252,14 @@  discard block
 block discarded – undo
252 252
 
253 253
         // Initialize the user class instance
254 254
         $this->xContainer->extend($sClassName, function($xClassInstance) use($sClassName) {
255
-            if($xClassInstance instanceof AbstractComponent)
255
+            if ($xClassInstance instanceof AbstractComponent)
256 256
             {
257 257
                 $xHelper = $this->get($this->getCallableHelperKey($sClassName));
258 258
                 $xHelper->xTarget = $this->xTarget;
259 259
 
260 260
                 // Call the protected "initComponent()" method of the Component class.
261 261
                 $cSetter = function($di, $xHelper) {
262
-                    $this->initComponent($di, $xHelper);  // "$this" here refers to the Component class.
262
+                    $this->initComponent($di, $xHelper); // "$this" here refers to the Component class.
263 263
                 };
264 264
                 $cSetter = $cSetter->bindTo($xClassInstance, $xClassInstance);
265 265
                 call_user_func($cSetter, $this->di, $xHelper);
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
             /** @var CallableObject */
275 275
             $xCallableObject = $this->get($this->getCallableObjectKey($sClassName));
276 276
             $xCallableObject->setDiClassAttributes($xClassInstance);
277
-            if($this->xTarget !== null)
277
+            if ($this->xTarget !== null)
278 278
             {
279 279
                 $sMethodName = $this->xTarget->getMethodName();
280 280
                 $xCallableObject->setDiMethodAttributes($xClassInstance, $sMethodName);
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
     private function registerRequestFactory(string $sClassName, string $sFactoryKey)
351 351
     {
352 352
         $this->xContainer->offsetSet($sFactoryKey, function() use($sClassName) {
353
-            if(!($xCallable = $this->makeCallableObject($sClassName)))
353
+            if (!($xCallable = $this->makeCallableObject($sClassName)))
354 354
             {
355 355
                 return null;
356 356
             }
@@ -380,13 +380,13 @@  discard block
 block discarded – undo
380 380
     public function getComponentRequestFactory(string $sClassName): ?JxnCall
381 381
     {
382 382
         $sClassName = trim($sClassName, " \t");
383
-        if($sClassName === '')
383
+        if ($sClassName === '')
384 384
         {
385 385
             return null;
386 386
         }
387 387
 
388 388
         $sFactoryKey = $this->getRequestFactoryKey($sClassName);
389
-        if(!$this->has($sFactoryKey))
389
+        if (!$this->has($sFactoryKey))
390 390
         {
391 391
             $this->registerRequestFactory($sClassName, $sFactoryKey);
392 392
         }
Please login to merge, or discard this patch.
jaxon-core/src/App/Metadata/MetadataCache.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -51,12 +51,12 @@
 block discarded – undo
51 51
         $sMetadataVar = '$xMetadata';
52 52
         $sDataVar = '$xData';
53 53
         $aCalls = ["$sMetadataVar = new " . Metadata::class . '();'];
54
-        foreach($xMetadata->getAttributes() as $sType => $aValues)
54
+        foreach ($xMetadata->getAttributes() as $sType => $aValues)
55 55
         {
56
-            foreach($aValues as $sMethod => $xData)
56
+            foreach ($aValues as $sMethod => $xData)
57 57
             {
58 58
                 $aCalls[] = "$sDataVar = {$sMetadataVar}->{$sType}('{$sMethod}');";
59
-                foreach($xData->encode($sDataVar) as $sCall)
59
+                foreach ($xData->encode($sDataVar) as $sCall)
60 60
                 {
61 61
                     $aCalls[] = $sCall;
62 62
                 }
Please login to merge, or discard this patch.
jaxon-core/src/App/Metadata/Data/ContainerData.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
      */
52 52
     protected function validateAttr(string $sAttr): void
53 53
     {
54
-        if(preg_match('/^[a-zA-Z][a-zA-Z0-9_]*$/', $sAttr) > 0)
54
+        if (preg_match('/^[a-zA-Z][a-zA-Z0-9_]*$/', $sAttr) > 0)
55 55
         {
56 56
             return;
57 57
         }
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
      */
66 66
     protected function validateClass(string $sClass): void
67 67
     {
68
-        if(preg_match('/^(\\\)?([a-zA-Z][a-zA-Z0-9_]*)(\\\[a-zA-Z][a-zA-Z0-9_]*)*$/', $sClass) > 0)
68
+        if (preg_match('/^(\\\)?([a-zA-Z][a-zA-Z0-9_]*)(\\\[a-zA-Z][a-zA-Z0-9_]*)*$/', $sClass) > 0)
69 69
         {
70 70
             return;
71 71
         }
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
     public function encode(string $sVarName): array
93 93
     {
94 94
         $aCalls = [];
95
-        foreach($this->aProperties as $sAttr => $sClass)
95
+        foreach ($this->aProperties as $sAttr => $sClass)
96 96
         {
97 97
             $aCalls[] = "{$sVarName}->addValue('$sAttr', '" . addslashes($sClass) . "');";
98 98
         }
Please login to merge, or discard this patch.