Passed
Push — main ( 8048d8...b663cc )
by Thierry
10:05 queued 07:59
created
src/Plugin/Request/CallableClass/CallableRepository.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 
111 111
         // The methods of the CallableClass class must not be exported
112 112
         $xCallableClass = new ReflectionClass(CallableClass::class);
113
-        foreach($xCallableClass->getMethods(ReflectionMethod::IS_PUBLIC) as $xMethod)
113
+        foreach ($xCallableClass->getMethods(ReflectionMethod::IS_PUBLIC) as $xMethod)
114 114
         {
115 115
             $this->aProtectedMethods[] = $xMethod->getName();
116 116
         }
@@ -181,15 +181,15 @@  discard block
 block discarded – undo
181 181
      */
182 182
     public function makeClassOptions(string $sClassName, array $aClassOptions, array $aDirectoryOptions): array
183 183
     {
184
-        foreach($this->aDefaultClassOptions as $sOption => $xValue)
184
+        foreach ($this->aDefaultClassOptions as $sOption => $xValue)
185 185
         {
186
-            if(!isset($aClassOptions[$sOption]))
186
+            if (!isset($aClassOptions[$sOption]))
187 187
             {
188 188
                 $aClassOptions[$sOption] = $xValue;
189 189
             }
190 190
         }
191
-        $aClassOptions['excluded'] = (bool)($aClassOptions['excluded'] ?? false); // Convert to bool.
192
-        if(is_string($aClassOptions['protected']))
191
+        $aClassOptions['excluded'] = (bool) ($aClassOptions['excluded'] ?? false); // Convert to bool.
192
+        if (is_string($aClassOptions['protected']))
193 193
         {
194 194
             $aClassOptions['protected'] = [$aClassOptions['protected']]; // Convert to array.
195 195
         }
@@ -200,25 +200,25 @@  discard block
 block discarded – undo
200 200
             $aDirectoryOptions['classes']['*'] ?? [], // Options for all classes
201 201
             $aDirectoryOptions['classes'][$sClassName] ?? [], // Options for this specific class
202 202
         ];
203
-        foreach($aOptionGroups as $aOptionGroup)
203
+        foreach ($aOptionGroups as $aOptionGroup)
204 204
         {
205
-            if(isset($aOptionGroup['separator']))
205
+            if (isset($aOptionGroup['separator']))
206 206
             {
207
-                $aClassOptions['separator'] = (string)$aOptionGroup['separator'];
207
+                $aClassOptions['separator'] = (string) $aOptionGroup['separator'];
208 208
             }
209
-            if(isset($aOptionGroup['excluded']))
209
+            if (isset($aOptionGroup['excluded']))
210 210
             {
211
-                $aClassOptions['excluded'] = (bool)$aOptionGroup['excluded'];
211
+                $aClassOptions['excluded'] = (bool) $aOptionGroup['excluded'];
212 212
             }
213
-            if(isset($aOptionGroup['protected']))
213
+            if (isset($aOptionGroup['protected']))
214 214
             {
215
-                if(is_string($aOptionGroup['protected']))
215
+                if (is_string($aOptionGroup['protected']))
216 216
                 {
217 217
                     $aOptionGroup['protected'] = [$aOptionGroup['protected']]; // Convert to array.
218 218
                 }
219 219
                 $aClassOptions['protected'] = array_merge($aClassOptions['protected'], $aOptionGroup['protected']);
220 220
             }
221
-            if(isset($aOptionGroup['functions']))
221
+            if (isset($aOptionGroup['functions']))
222 222
             {
223 223
                 $aClassOptions['functions'] = array_merge($aClassOptions['functions'], $aOptionGroup['functions']);
224 224
             }
@@ -264,10 +264,10 @@  discard block
 block discarded – undo
264 264
     private function getNamespaceClassOptions(string $sClassName)
265 265
     {
266 266
         // Find the corresponding namespace
267
-        foreach($this->aNamespaceOptions as $sNamespace => $aOptions)
267
+        foreach ($this->aNamespaceOptions as $sNamespace => $aOptions)
268 268
         {
269 269
             // Check if the namespace matches the class.
270
-            if(strncmp($sClassName, $sNamespace . '\\', strlen($sNamespace) + 1) === 0)
270
+            if (strncmp($sClassName, $sNamespace . '\\', strlen($sNamespace) + 1) === 0)
271 271
             {
272 272
                 // Save the class options
273 273
                 $this->aClasses[$sClassName] = $this->makeClassOptions($sClassName,
@@ -288,17 +288,17 @@  discard block
 block discarded – undo
288 288
     public function getClassOptions(string $sClassName): array
289 289
     {
290 290
         // Find options for a class registered with namespace.
291
-        if(!isset($this->aClasses[$sClassName]))
291
+        if (!isset($this->aClasses[$sClassName]))
292 292
         {
293 293
             $this->getNamespaceClassOptions($sClassName);
294
-            if(!isset($this->aClasses[$sClassName]))
294
+            if (!isset($this->aClasses[$sClassName]))
295 295
             {
296 296
                 // Find options for a class registered without namespace.
297 297
                 // We then need to parse all classes to be able to find one.
298 298
                 $this->di->getCallableRegistry()->parseDirectories();
299 299
             }
300 300
         }
301
-        if(isset($this->aClasses[$sClassName]))
301
+        if (isset($this->aClasses[$sClassName]))
302 302
         {
303 303
             return $this->aClasses[$sClassName];
304 304
         }
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
     public function getCallableObjects(): array
328 328
     {
329 329
         $aCallableObjects = [];
330
-        foreach($this->aClasses as $sClassName => $aOptions)
330
+        foreach ($this->aClasses as $sClassName => $aOptions)
331 331
         {
332 332
             $this->di->registerCallableClass($sClassName, $aOptions);
333 333
             $aCallableObjects[$sClassName] = $this->di->getCallableObject($sClassName);
Please login to merge, or discard this patch.
src/Di/Container.php 3 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
      */
215 215
     public function set(string $sClass, Closure $xClosure)
216 216
     {
217
-       $this->xLibContainer->offsetSet($sClass, function() use($xClosure) {
217
+        $this->xLibContainer->offsetSet($sClass, function() use($xClosure) {
218 218
             return $xClosure($this);
219 219
         });
220 220
     }
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
      */
230 230
     public function val(string $sKey, $xValue)
231 231
     {
232
-       $this->xLibContainer->offsetSet($sKey, $xValue);
232
+        $this->xLibContainer->offsetSet($sKey, $xValue);
233 233
     }
234 234
 
235 235
     /**
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
      */
158 158
     public function has(string $sClass): bool
159 159
     {
160
-        if($this->xAppContainer != null && $this->xAppContainer->has($sClass))
160
+        if ($this->xAppContainer != null && $this->xAppContainer->has($sClass))
161 161
         {
162 162
             return true;
163 163
         }
@@ -188,13 +188,13 @@  discard block
 block discarded – undo
188 188
     {
189 189
         try
190 190
         {
191
-            if($this->xAppContainer != null && $this->xAppContainer->has($sClass))
191
+            if ($this->xAppContainer != null && $this->xAppContainer->has($sClass))
192 192
             {
193 193
                 return $this->xAppContainer->get($sClass);
194 194
             }
195 195
             return $this->xLibContainer->offsetGet($sClass);
196 196
         }
197
-        catch(Exception|Throwable $e)
197
+        catch (Exception | Throwable $e)
198 198
         {
199 199
             $xLogger = $this->g(LoggerInterface::class);
200 200
             $xTranslator = $this->g(Translator::class);
@@ -258,15 +258,15 @@  discard block
 block discarded – undo
258 258
     {
259 259
         $xType = $xParameter->getType();
260 260
         // Check the parameter class first.
261
-        if($xType instanceof ReflectionNamedType)
261
+        if ($xType instanceof ReflectionNamedType)
262 262
         {
263 263
             // Check the class + the name
264
-            if($this->has($xType->getName() . ' $' . $xParameter->getName()))
264
+            if ($this->has($xType->getName() . ' $' . $xParameter->getName()))
265 265
             {
266 266
                 return $this->get($xType->getName() . ' $' . $xParameter->getName());
267 267
             }
268 268
             // Check the class only
269
-            if($this->get($xType->getName()))
269
+            if ($this->get($xType->getName()))
270 270
             {
271 271
                 return $this->get($xType->getName());
272 272
             }
@@ -286,16 +286,16 @@  discard block
 block discarded – undo
286 286
      */
287 287
     public function make($xClass)
288 288
     {
289
-        if(is_string($xClass))
289
+        if (is_string($xClass))
290 290
         {
291 291
             $xClass = new ReflectionClass($xClass); // Create the reflection class instance
292 292
         }
293
-        if(!($xClass instanceof ReflectionClass))
293
+        if (!($xClass instanceof ReflectionClass))
294 294
         {
295 295
             return null;
296 296
         }
297 297
         // Use the Reflection class to get the parameters of the constructor
298
-        if(($constructor = $xClass->getConstructor()) === null)
298
+        if (($constructor = $xClass->getConstructor()) === null)
299 299
         {
300 300
             return $xClass->newInstance();
301 301
         }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -193,8 +193,7 @@
 block discarded – undo
193 193
                 return $this->xAppContainer->get($sClass);
194 194
             }
195 195
             return $this->xLibContainer->offsetGet($sClass);
196
-        }
197
-        catch(Exception|Throwable $e)
196
+        } catch(Exception|Throwable $e)
198 197
         {
199 198
             $xLogger = $this->g(LoggerInterface::class);
200 199
             $xTranslator = $this->g(Translator::class);
Please login to merge, or discard this patch.