Passed
Push — master ( baf979...6da3e4 )
by Thierry
03:26
created
src/Di/Container.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
      */
145 145
     public function has(string $sClass): bool
146 146
     {
147
-        if($this->xContainer != null && $this->xContainer->has($sClass))
147
+        if ($this->xContainer != null && $this->xContainer->has($sClass))
148 148
         {
149 149
             return true;
150 150
         }
@@ -175,13 +175,13 @@  discard block
 block discarded – undo
175 175
     {
176 176
         try
177 177
         {
178
-            if($this->xContainer != null && $this->xContainer->has($sClass))
178
+            if ($this->xContainer != null && $this->xContainer->has($sClass))
179 179
             {
180 180
                 return $this->xContainer->get($sClass);
181 181
             }
182 182
             return $this->offsetGet($sClass);
183 183
         }
184
-        catch(Exception|Throwable $e)
184
+        catch (Exception | Throwable $e)
185 185
         {
186 186
             $xLogger = $this->g(LoggerInterface::class);
187 187
             $xTranslator = $this->g(Translator::class);
@@ -243,15 +243,15 @@  discard block
 block discarded – undo
243 243
     {
244 244
         $xType = $xParameter->getType();
245 245
         // Check the parameter class first.
246
-        if($xType instanceof ReflectionNamedType)
246
+        if ($xType instanceof ReflectionNamedType)
247 247
         {
248 248
             // Check the class + the name
249
-            if($this->has($xType->getName() . ' $' . $xParameter->getName()))
249
+            if ($this->has($xType->getName() . ' $' . $xParameter->getName()))
250 250
             {
251 251
                 return $this->get($xType->getName() . ' $' . $xParameter->getName());
252 252
             }
253 253
             // Check the class only
254
-            if($this->get($xType->getName()))
254
+            if ($this->get($xType->getName()))
255 255
             {
256 256
                 return $this->get($xType->getName());
257 257
             }
@@ -271,16 +271,16 @@  discard block
 block discarded – undo
271 271
      */
272 272
     public function make($xClass)
273 273
     {
274
-        if(is_string($xClass))
274
+        if (is_string($xClass))
275 275
         {
276 276
             $xClass = new ReflectionClass($xClass); // Create the reflection class instance
277 277
         }
278
-        if(!($xClass instanceof ReflectionClass))
278
+        if (!($xClass instanceof ReflectionClass))
279 279
         {
280 280
             return null;
281 281
         }
282 282
         // Use the Reflection class to get the parameters of the constructor
283
-        if(($constructor = $xClass->getConstructor()) === null)
283
+        if (($constructor = $xClass->getConstructor()) === null)
284 284
         {
285 285
             return $xClass->newInstance();
286 286
         }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -180,8 +180,7 @@
 block discarded – undo
180 180
                 return $this->xContainer->get($sClass);
181 181
             }
182 182
             return $this->offsetGet($sClass);
183
-        }
184
-        catch(Exception|Throwable $e)
183
+        } catch(Exception|Throwable $e)
185 184
         {
186 185
             $xLogger = $this->g(LoggerInterface::class);
187 186
             $xTranslator = $this->g(Translator::class);
Please login to merge, or discard this patch.