Passed
Push — main ( 7f530d...7aae9b )
by Thierry
05:54
created
jaxon-attributes/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-attributes/src/AttributeReader.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -258,8 +258,7 @@
 block discarded – undo
258 258
             }
259 259
 
260 260
             return $this->xMetadata;
261
-        }
262
-        catch(Exception|Error $e)
261
+        } catch(Exception|Error $e)
263 262
         {
264 263
             throw new SetupException($e->getMessage());
265 264
         }
Please login to merge, or discard this patch.
Spacing   +19 added lines, -21 removed lines patch added patch discarded remove patch
@@ -82,19 +82,19 @@  discard block
 block discarded – undo
82 82
     private function readTypes(ReflectionClass $xClass)
83 83
     {
84 84
         $sClass = $xClass->getName();
85
-        if(isset($this->aTypes[$sClass]))
85
+        if (isset($this->aTypes[$sClass]))
86 86
         {
87 87
             return;
88 88
         }
89 89
 
90 90
         $this->aTypes[$sClass] = [];
91
-        $aProperties = $xClass->getProperties(ReflectionProperty::IS_PUBLIC |
91
+        $aProperties = $xClass->getProperties(ReflectionProperty::IS_PUBLIC|
92 92
             ReflectionProperty::IS_PROTECTED);
93
-        foreach($aProperties as $xReflectionProperty)
93
+        foreach ($aProperties as $xReflectionProperty)
94 94
         {
95 95
             $xType = $xReflectionProperty->getType();
96 96
             // Check that the property has a valid type defined
97
-            if(is_a($xType, ReflectionNamedType::class) &&
97
+            if (is_a($xType, ReflectionNamedType::class) &&
98 98
                 ($sType = $xType->getName()) !== '')
99 99
             {
100 100
                 $this->aTypes[$sClass][$xReflectionProperty->getName()] = $sType;
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
     private function initAttribute(AbstractAttribute $xAttribute,
113 113
         ReflectionClass $xClass, ReflectionAttribute $xReflectionAttribute): void
114 114
     {
115
-        if(is_a($xAttribute, InjectAttribute::class))
115
+        if (is_a($xAttribute, InjectAttribute::class))
116 116
         {
117 117
             $this->readTypes($xClass);
118 118
             $xAttribute->setTarget($xReflectionAttribute->getTarget());
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
         $aAttributes = $xClass->getAttributes();
161 161
         $aAttributes = array_filter($aAttributes, fn($xReflectionAttribute) =>
162 162
             $this->isBaseClassAttribute($xReflectionAttribute));
163
-        foreach($aAttributes as $xReflectionAttribute)
163
+        foreach ($aAttributes as $xReflectionAttribute)
164 164
         {
165 165
             $xReflectionAttribute->newInstance()->saveValue($this->xMetadata);
166 166
         }
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
         $aAttributes = array_filter($aAttributes, fn($xReflectionAttribute) =>
178 178
             $this->isJaxonAttribute($xReflectionAttribute) &&
179 179
             !$this->isBaseClassAttribute($xReflectionAttribute));
180
-        foreach($aAttributes as $xReflectionAttribute)
180
+        foreach ($aAttributes as $xReflectionAttribute)
181 181
         {
182 182
             $xAttribute = $xReflectionAttribute->newInstance();
183 183
             $this->initAttribute($xAttribute, $xClass, $xReflectionAttribute);
@@ -195,17 +195,16 @@  discard block
 block discarded – undo
195 195
      */
196 196
     private function readPropertyAttributes(ReflectionClass $xClass, string $sProperty): void
197 197
     {
198
-        $aAttributes = !$xClass->hasProperty($sProperty) ? [] :
199
-            $xClass->getProperty($sProperty)->getAttributes();
198
+        $aAttributes = !$xClass->hasProperty($sProperty) ? [] : $xClass->getProperty($sProperty)->getAttributes();
200 199
         $aAttributes = array_filter($aAttributes, fn($xReflectionAttribute) =>
201 200
             $this->isPropertyAttribute($xReflectionAttribute));
202 201
         // Only Inject attributes are allowed on properties
203
-        if(count($aAttributes) > 1)
202
+        if (count($aAttributes) > 1)
204 203
         {
205 204
             throw new SetupException('Only one Inject attribute is allowed on a property');
206 205
         }
207 206
 
208
-        foreach($aAttributes as $xReflectionAttribute)
207
+        foreach ($aAttributes as $xReflectionAttribute)
209 208
         {
210 209
             /** @var InjectAttribute */
211 210
             $xAttribute = $xReflectionAttribute->newInstance();
@@ -224,11 +223,10 @@  discard block
 block discarded – undo
224 223
      */
225 224
     private function readMethodAttributes(ReflectionClass $xClass, string $sMethod): void
226 225
     {
227
-        $aAttributes = !$xClass->hasMethod($sMethod) ? [] :
228
-            $xClass->getMethod($sMethod)->getAttributes();
226
+        $aAttributes = !$xClass->hasMethod($sMethod) ? [] : $xClass->getMethod($sMethod)->getAttributes();
229 227
         $aAttributes = array_filter($aAttributes, fn($xReflectionAttribute) =>
230 228
             $this->isJaxonAttribute($xReflectionAttribute));
231
-        foreach($aAttributes as $xReflectionAttribute)
229
+        foreach ($aAttributes as $xReflectionAttribute)
232 230
         {
233 231
             $xAttribute = $xReflectionAttribute->newInstance();
234 232
             $this->initAttribute($xAttribute, $xClass, $xReflectionAttribute);
@@ -263,33 +261,33 @@  discard block
 block discarded – undo
263 261
             $this->readBaseClassAttributes($xClass);
264 262
 
265 263
             $aClasses = [$xClass];
266
-            while(($xClass = $this->getParentClass($xClass)) !== null)
264
+            while (($xClass = $this->getParentClass($xClass)) !== null)
267 265
             {
268 266
                 $aClasses[] = $xClass;
269 267
             }
270 268
             $aClasses = array_reverse($aClasses);
271 269
 
272
-            foreach($aClasses as $xClass)
270
+            foreach ($aClasses as $xClass)
273 271
             {
274 272
                 // Processing class attributes
275 273
                 $this->readClassAttributes($xClass);
276 274
                 // Processing properties attributes
277
-                foreach($xInput->getProperties() as $sProperty)
275
+                foreach ($xInput->getProperties() as $sProperty)
278 276
                 {
279 277
                     $this->readPropertyAttributes($xClass, $sProperty);
280 278
                 }
281 279
             }
282 280
 
283 281
             // The methods attributes are not taken for excluded classes.
284
-            if($this->xMetadata->isExcluded())
282
+            if ($this->xMetadata->isExcluded())
285 283
             {
286 284
                 return $this->xMetadata;
287 285
             }
288 286
 
289
-            foreach($aClasses as $xClass)
287
+            foreach ($aClasses as $xClass)
290 288
             {
291 289
                 // Processing methods attributes
292
-                foreach($xInput->getMethods() as $sMethod)
290
+                foreach ($xInput->getMethods() as $sMethod)
293 291
                 {
294 292
                     $this->readMethodAttributes($xClass, $sMethod);
295 293
                 }
@@ -297,7 +295,7 @@  discard block
 block discarded – undo
297 295
 
298 296
             return $this->xMetadata;
299 297
         }
300
-        catch(Exception|Error $e)
298
+        catch (Exception|Error $e)
301 299
         {
302 300
             throw new SetupException($e->getMessage());
303 301
         }
Please login to merge, or discard this patch.
jaxon-attributes/src/Attribute/Before.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
 use Jaxon\App\Metadata\Metadata;
19 19
 use Attribute;
20 20
 
21
-#[Attribute(Attribute::TARGET_CLASS | Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)]
21
+#[Attribute(Attribute::TARGET_CLASS|Attribute::TARGET_METHOD|Attribute::IS_REPEATABLE)]
22 22
 class Before extends AbstractAttribute
23 23
 {
24 24
     /**
Please login to merge, or discard this patch.
jaxon-attributes/src/Attribute/Callback.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
 use Jaxon\App\Metadata\Metadata;
19 19
 use Attribute;
20 20
 
21
-#[Attribute(Attribute::TARGET_CLASS | Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)]
21
+#[Attribute(Attribute::TARGET_CLASS|Attribute::TARGET_METHOD|Attribute::IS_REPEATABLE)]
22 22
 class Callback extends AbstractAttribute
23 23
 {
24 24
     /**
Please login to merge, or discard this patch.
jaxon-attributes/src/Attribute/Exclude.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
 use Jaxon\App\Metadata\Metadata;
19 19
 use Attribute;
20 20
 
21
-#[Attribute(Attribute::TARGET_CLASS | Attribute::TARGET_METHOD)]
21
+#[Attribute(Attribute::TARGET_CLASS|Attribute::TARGET_METHOD)]
22 22
 class Exclude extends AbstractAttribute
23 23
 {
24 24
     /**
Please login to merge, or discard this patch.
jaxon-attributes/src/Attribute/After.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
 use Jaxon\App\Metadata\Metadata;
19 19
 use Attribute;
20 20
 
21
-#[Attribute(Attribute::TARGET_CLASS | Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)]
21
+#[Attribute(Attribute::TARGET_CLASS|Attribute::TARGET_METHOD|Attribute::IS_REPEATABLE)]
22 22
 class After extends AbstractAttribute
23 23
 {
24 24
     /**
Please login to merge, or discard this patch.
jaxon-core/tests/src/session.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -95,7 +95,7 @@
 block discarded – undo
95 95
      */
96 96
     public function delete(string $sKey): void
97 97
     {
98
-        if(isset($_SESSION[$sKey]))
98
+        if (isset($_SESSION[$sKey]))
99 99
         {
100 100
             unset($_SESSION[$sKey]);
101 101
         }
Please login to merge, or discard this patch.
jaxon-core/tests/src/response/TestHk.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@
 block discarded – undo
67 67
 
68 68
     public function param($param)
69 69
     {
70
-        if($this->method === 'param' && $this->args[0] === $param)
70
+        if ($this->method === 'param' && $this->args[0] === $param)
71 71
         {
72 72
             $this->response->html('div-id', 'This is the method with params!');
73 73
         }
Please login to merge, or discard this patch.
jaxon-core/templates/pagination/wrapper.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@
 block discarded – undo
1 1
 <ul class="pagination"><?php
2
-    if(($this->prev))
2
+    if (($this->prev))
3 3
     {
4 4
         echo $this->prev;
5 5
     }
6
-    foreach($this->links as $link)
6
+    foreach ($this->links as $link)
7 7
     {
8 8
         echo $link;
9 9
     }
10
-    if(($this->next))
10
+    if (($this->next))
11 11
     {
12 12
         echo $this->next;
13 13
     }
Please login to merge, or discard this patch.