Passed
Push — main ( ca0571...5ee2f7 )
by Thierry
03:43
created
jaxon-annotations/tests/TestAnnotation/TraitAnnotationTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@
 block discarded – undo
45 45
         $aFiles = scandir($this->sCacheDir);
46 46
         foreach ($aFiles as $sFile)
47 47
         {
48
-            if($sFile !== '.' && $sFile !== '..')
48
+            if ($sFile !== '.' && $sFile !== '..')
49 49
             {
50 50
                 @unlink($this->sCacheDir . DIRECTORY_SEPARATOR . $sFile);
51 51
             }
Please login to merge, or discard this patch.
jaxon-annotations/tests/TestAnnotation/AnnotationTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@
 block discarded – undo
45 45
         $aFiles = scandir($this->sCacheDir);
46 46
         foreach ($aFiles as $sFile)
47 47
         {
48
-            if($sFile !== '.' && $sFile !== '..')
48
+            if ($sFile !== '.' && $sFile !== '..')
49 49
             {
50 50
                 @unlink($this->sCacheDir . DIRECTORY_SEPARATOR . $sFile);
51 51
             }
Please login to merge, or discard this patch.
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 2 patches
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.
Switch Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -28,18 +28,18 @@  discard block
 block discarded – undo
28 28
 
29 29
 class CallFactory
30 30
 {
31
-    /**
31
+/**
32 32
      * The constructor.
33 33
      *
34 34
      * @param ComponentContainer $cdi
35 35
      * @param DialogCommand $xDialogCommand
36 36
      */
37
-    public function __construct(private ComponentContainer $cdi, DialogCommand $xDialogCommand)
38
-    {
39
-        JsExpr::setDialogCommand($xDialogCommand);
40
-    }
37
+public function __construct(private ComponentContainer $cdi, DialogCommand $xDialogCommand)
38
+{
39
+JsExpr::setDialogCommand($xDialogCommand);
40
+}
41 41
 
42
-    /**
42
+/**
43 43
      * Get a factory for a registered class.
44 44
      *
45 45
      * @param string $sClassName
@@ -47,14 +47,14 @@  discard block
 block discarded – undo
47 47
      * @return JxnCall|null
48 48
      * @throws SetupException
49 49
      */
50
-    public function rq(string $sClassName = ''): ?JxnCall
51
-    {
52
-        $sClassName = trim($sClassName);
53
-        return $sClassName === '' ? $this->cdi->getFunctionRequestFactory() :
54
-            $this->cdi->getComponentRequestFactory($sClassName);
55
-    }
50
+public function rq(string $sClassName = ''): ?JxnCall
51
+{
52
+$sClassName = trim($sClassName);
53
+return $sClassName === '' ? $this->cdi->getFunctionRequestFactory() :
54
+$this->cdi->getComponentRequestFactory($sClassName);
55
+}
56 56
 
57
-    /**
57
+/**
58 58
      * Get a factory for a Javascript object.
59 59
      *
60 60
      * @param string $sObject
@@ -62,17 +62,17 @@  discard block
 block discarded – undo
62 62
      *
63 63
      * @return JsObjectCall|null
64 64
      */
65
-    public function jo(string $sObject = '', ?Closure $xExprCb = null): ?JsObjectCall
66
-    {
67
-        /*
65
+public function jo(string $sObject = '', ?Closure $xExprCb = null): ?JsObjectCall
66
+{
67
+/*
68 68
          * The provided closure will be called each time a js expression is created with this factory,
69 69
          * with the expression as the only parameter.
70 70
          * It is currently used to attach the expression to a Jaxon response.
71 71
          */
72
-        return new JsObjectCall($xExprCb, trim($sObject, " \t"));
73
-    }
72
+return new JsObjectCall($xExprCb, trim($sObject, " \t"));
73
+}
74 74
 
75
-    /**
75
+/**
76 76
      * Get a factory for a JQuery selector.
77 77
      *
78 78
      * @param string $sPath    The jQuery selector path
@@ -81,17 +81,17 @@  discard block
 block discarded – undo
81 81
      *
82 82
      * @return JqSelectorCall
83 83
      */
84
-    public function jq(string $sPath = '', $xContext = null, ?Closure $xExprCb = null): JqSelectorCall
85
-    {
86
-        /*
84
+public function jq(string $sPath = '', $xContext = null, ?Closure $xExprCb = null): JqSelectorCall
85
+{
86
+/*
87 87
          * The provided closure will be called each time a js expression is created with this factory,
88 88
          * with the expression as the only parameter.
89 89
          * It is currently used to attach the expression to a Jaxon response.
90 90
          */
91
-        return new JqSelectorCall($xExprCb, trim($sPath, " \t"), $xContext);
92
-    }
91
+return new JqSelectorCall($xExprCb, trim($sPath, " \t"), $xContext);
92
+}
93 93
 
94
-    /**
94
+/**
95 95
      * Get a factory for a Javascript element selector.
96 96
      *
97 97
      * @param string $sElementId    The DOM element id
@@ -99,13 +99,13 @@  discard block
 block discarded – undo
99 99
      *
100 100
      * @return JsSelectorCall
101 101
      */
102
-    public function je(string $sElementId = '', ?Closure $xExprCb = null): JsSelectorCall
103
-    {
104
-        /*
102
+public function je(string $sElementId = '', ?Closure $xExprCb = null): JsSelectorCall
103
+{
104
+/*
105 105
          * The provided closure will be called each time a js expression is created with this factory,
106 106
          * with the expression as the only parameter.
107 107
          * It is currently used to attach the expression to a Jaxon response.
108 108
          */
109
-        return new JsSelectorCall($xExprCb, trim($sElementId, " \t"));
110
-    }
109
+return new JsSelectorCall($xExprCb, trim($sElementId, " \t"));
110
+}
111 111
 }
Please login to merge, or discard this patch.
jaxon-core/src/Di/ComponentContainer.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -138,7 +138,7 @@
 block discarded – undo
138 138
      */
139 139
     public function val(string $sKey, $xValue)
140 140
     {
141
-       $this->xContainer->offsetSet($sKey, $xValue);
141
+        $this->xContainer->offsetSet($sKey, $xValue);
142 142
     }
143 143
 
144 144
     /**
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -169,13 +169,13 @@  discard block
 block discarded – undo
169 169
         try
170 170
         {
171 171
             // Make sure the registered class exists
172
-            if(isset($aOptions['include']))
172
+            if (isset($aOptions['include']))
173 173
             {
174 174
                 require_once $aOptions['include'];
175 175
             }
176 176
             $xReflectionClass = new ReflectionClass($sClassName);
177 177
             // Check if the class is registrable
178
-            if(!$xReflectionClass->isInstantiable())
178
+            if (!$xReflectionClass->isInstantiable())
179 179
             {
180 180
                 return;
181 181
             }
@@ -185,12 +185,12 @@  discard block
 block discarded – undo
185 185
             $sClassKey = $this->getReflectionClassKey($sClassName);
186 186
             $this->val($sClassKey, $xReflectionClass);
187 187
             // Register the user class, but only if the user didn't already.
188
-            if(!$this->has($sClassName))
188
+            if (!$this->has($sClassName))
189 189
             {
190 190
                 $this->set($sClassName, fn() => $this->make($this->get($sClassKey)));
191 191
             }
192 192
         }
193
-        catch(ReflectionException $e)
193
+        catch (ReflectionException $e)
194 194
         {
195 195
             throw new SetupException($this->cn()->g(Translator::class)
196 196
                 ->trans('errors.class.invalid', ['name' => $sClassName]));
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
 
213 213
         $sComponentObject = $this->getCallableObjectKey($sClassName);
214 214
         // Prevent duplication. It's important not to use the class name here.
215
-        if($this->has($sComponentObject))
215
+        if ($this->has($sComponentObject))
216 216
         {
217 217
             return $sClassName;
218 218
         }
@@ -238,14 +238,14 @@  discard block
 block discarded – undo
238 238
 
239 239
         // Initialize the user class instance
240 240
         $this->xContainer->extend($sClassName, function($xClassInstance) use($sClassName) {
241
-            if($xClassInstance instanceof AbstractComponent)
241
+            if ($xClassInstance instanceof AbstractComponent)
242 242
             {
243 243
                 $xHelper = $this->get($this->getCallableHelperKey($sClassName));
244 244
                 $xHelper->xTarget = $this->xTarget;
245 245
 
246 246
                 // Call the protected "initComponent()" method of the Component class.
247 247
                 $cSetter = function($di, $xHelper) {
248
-                    $this->initComponent($di, $xHelper);  // "$this" here refers to the Component class.
248
+                    $this->initComponent($di, $xHelper); // "$this" here refers to the Component class.
249 249
                 };
250 250
                 $cSetter = $cSetter->bindTo($xClassInstance, $xClassInstance);
251 251
                 call_user_func($cSetter, $this->di, $xHelper);
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
             /** @var CallableObject */
261 261
             $xCallableObject = $this->get($this->getCallableObjectKey($sClassName));
262 262
             $xCallableObject->setDiClassAttributes($xClassInstance);
263
-            if($this->xTarget !== null)
263
+            if ($this->xTarget !== null)
264 264
             {
265 265
                 $sMethodName = $this->xTarget->getMethodName();
266 266
                 $xCallableObject->setDiMethodAttributes($xClassInstance, $sMethodName);
@@ -323,17 +323,17 @@  discard block
 block discarded – undo
323 323
     public function getComponentRequestFactory(string $sClassName): ?JxnCall
324 324
     {
325 325
         $sClassName = trim($sClassName, " \t");
326
-        if($sClassName === '')
326
+        if ($sClassName === '')
327 327
         {
328 328
             return null;
329 329
         }
330 330
 
331 331
         $sFactoryKey = $this->getRequestFactoryKey($sClassName);
332
-        if(!$this->has($sFactoryKey))
332
+        if (!$this->has($sFactoryKey))
333 333
         {
334 334
             $this->xContainer->offsetSet($sFactoryKey, function() use($sClassName) {
335 335
                 $sComponentId = str_replace('\\', '.', $sClassName);
336
-                if(!($xCallable = $this->makeCallableObject($sComponentId)))
336
+                if (!($xCallable = $this->makeCallableObject($sComponentId)))
337 337
                 {
338 338
                     return null;
339 339
                 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -189,8 +189,7 @@
 block discarded – undo
189 189
             {
190 190
                 $this->set($sClassName, fn() => $this->make($this->get($sClassKey)));
191 191
             }
192
-        }
193
-        catch(ReflectionException $e)
192
+        } catch(ReflectionException $e)
194 193
         {
195 194
             throw new SetupException($this->cn()->g(Translator::class)
196 195
                 ->trans('errors.class.invalid', ['name' => $sClassName]));
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.