Completed
Push — master ( cec675...ca4bb7 )
by Raffael
01:59
created
src/Container.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -305,9 +305,9 @@
 block discarded – undo
305 305
 
306 306
                 $args[$param_name] = $this->findService($name, $type_class);
307 307
             } elseif($param->isDefaultValueAvailable()) {
308
-                 $args[$param_name] = $param->getDefaultValue();
308
+                    $args[$param_name] = $param->getDefaultValue();
309 309
             } elseif($param->allowsNull() && $param->hasType()) {
310
-                 $args[$param_name] = null;
310
+                    $args[$param_name] = null;
311 311
             } else {
312 312
                 throw new Exception\Configuration('no value found for argument '.$param_name.' in method '.$method->getName().' for service '.$name);
313 313
             }
Please login to merge, or discard this patch.
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types=1);
3
+declare(strict_types = 1);
4 4
 
5 5
 /**
6 6
  * Balloon
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
      *
61 61
      * @param Iterable $config
62 62
      */
63
-    public function __construct(Iterable $config = [], ?ContainerInterface $parent=null)
63
+    public function __construct(Iterable $config = [], ?ContainerInterface $parent = null)
64 64
     {
65 65
         $this->config = $config;
66 66
         $this->parent = $parent;
@@ -84,13 +84,13 @@  discard block
 block discarded – undo
84 84
             return $this->addStaticService($name);
85 85
         }
86 86
 
87
-        if(isset($this->config[$name])) {
87
+        if (isset($this->config[$name])) {
88 88
             return $this->autoWireClass($name);
89 89
         }
90 90
 
91 91
         try {
92 92
             return $this->lookupService($name);
93
-        } catch(Exception\ServiceNotFound $e) {
93
+        } catch (Exception\ServiceNotFound $e) {
94 94
             return $this->autoWireClass($name);
95 95
         }
96 96
     }
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
      */
104 104
     protected function addStaticService(string $name)
105 105
     {
106
-        if( $this->registry[$name] instanceof Closure) {
106
+        if ($this->registry[$name] instanceof Closure) {
107 107
             $this->service[$name] = $this->registry[$name]->call($this);
108 108
         } else {
109 109
             $this->service[$name] = $this->registry[$name];
@@ -129,11 +129,11 @@  discard block
 block discarded – undo
129 129
             return $this->addStaticService($name);
130 130
         }
131 131
 
132
-        if(isset($this->config[$name])) {
132
+        if (isset($this->config[$name])) {
133 133
             return $this->autoWireClass($name);
134 134
         }
135 135
 
136
-        if($this->parent !== null) {
136
+        if ($this->parent !== null) {
137 137
             return $this->parent->lookupService($name);
138 138
         }
139 139
 
@@ -211,13 +211,13 @@  discard block
 block discarded – undo
211 211
             $class = $config['use'];
212 212
         }
213 213
 
214
-        if(preg_match('#^\{(.*)\}$#', $class, $match)) {
214
+        if (preg_match('#^\{(.*)\}$#', $class, $match)) {
215 215
             $service = $this->get($match[1]);
216 216
 
217
-            if(isset($this->config[$name]['selects'])) {
217
+            if (isset($this->config[$name]['selects'])) {
218 218
                 $reflection = new ReflectionClass(get_class($service));
219 219
 
220
-                foreach($this->config[$name]['selects'] as $select) {
220
+                foreach ($this->config[$name]['selects'] as $select) {
221 221
                     $args = $this->autoWireMethod($name, $reflection->getMethod($select['method']), $select);
222 222
                     $service = call_user_func_array([&$service, $select['method']], $args);
223 223
                 }
@@ -256,16 +256,16 @@  discard block
 block discarded – undo
256 256
         $instance = $class->newInstanceArgs($arguments);
257 257
         $this->service[$name] = $instance;
258 258
 
259
-        if(isset($this->config[$name]['calls'])) {
260
-            foreach($this->config[$name]['calls'] as $call) {
261
-                if(!isset($call['method'])) {
259
+        if (isset($this->config[$name]['calls'])) {
260
+            foreach ($this->config[$name]['calls'] as $call) {
261
+                if (!isset($call['method'])) {
262 262
                     throw new Exception\Configuration('method is required for setter injection in service '.$name);
263 263
                 }
264 264
 
265 265
                 $arguments = [];
266 266
                 try {
267 267
                     $method = $class->getMethod($call['method']);
268
-                } catch(\ReflectionException $e) {
268
+                } catch (\ReflectionException $e) {
269 269
                     throw new Exception\Configuration('method '.$call['method'].' is not callable in class '.$class->getName().' for service '.$name);
270 270
                 }
271 271
 
@@ -294,9 +294,9 @@  discard block
 block discarded – undo
294 294
             $type = $param->getClass();
295 295
             $param_name = $param->getName();
296 296
 
297
-            if(isset($config['arguments'][$param_name])) {
297
+            if (isset($config['arguments'][$param_name])) {
298 298
                 $args[$param_name] = $this->parseParam($config['arguments'][$param_name], $name);
299
-            } elseif($type !== null) {
299
+            } elseif ($type !== null) {
300 300
                 $type_class = $type->getName();
301 301
 
302 302
                 if ($type_class === $name) {
@@ -304,9 +304,9 @@  discard block
 block discarded – undo
304 304
                 }
305 305
 
306 306
                 $args[$param_name] = $this->findService($name, $type_class);
307
-            } elseif($param->isDefaultValueAvailable()) {
307
+            } elseif ($param->isDefaultValueAvailable()) {
308 308
                  $args[$param_name] = $param->getDefaultValue();
309
-            } elseif($param->allowsNull() && $param->hasType()) {
309
+            } elseif ($param->allowsNull() && $param->hasType()) {
310 310
                  $args[$param_name] = null;
311 311
             } else {
312 312
                 throw new Exception\Configuration('no value found for argument '.$param_name.' in method '.$method->getName().' for service '.$name);
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
                 }
350 350
 
351 351
                 return str_replace($match[0], $env, $param);
352
-            } elseif(preg_match('#^\{(.*)\}$#', $param, $match)) {
352
+            } elseif (preg_match('#^\{(.*)\}$#', $param, $match)) {
353 353
                 return $this->findService($name, $match[1]);
354 354
             }
355 355
 
@@ -368,11 +368,11 @@  discard block
 block discarded – undo
368 368
      */
369 369
     protected function findService(string $current_service, string $service)
370 370
     {
371
-        if(isset($this->children[$current_service])) {
371
+        if (isset($this->children[$current_service])) {
372 372
             return $this->children[$current_service]->get($service);
373 373
         }
374 374
 
375
-        if(isset($this->config[$current_service]['services'])) {
375
+        if (isset($this->config[$current_service]['services'])) {
376 376
             $this->children[$current_service] = new self($this->config[$current_service]['services'], $this);
377 377
             return $this->children[$current_service]->get($service);
378 378
         }
Please login to merge, or discard this patch.
src/Exception/ServiceAlreadyExists.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types=1);
3
+declare(strict_types = 1);
4 4
 
5 5
 /**
6 6
  * balloon
Please login to merge, or discard this patch.
src/Exception/EnvVariableNotFound.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types=1);
3
+declare(strict_types = 1);
4 4
 
5 5
 /**
6 6
  * balloon
Please login to merge, or discard this patch.
src/Exception/Logic.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types=1);
3
+declare(strict_types = 1);
4 4
 
5 5
 /**
6 6
  * balloon
Please login to merge, or discard this patch.
src/Exception/ServiceNotFound.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types=1);
3
+declare(strict_types = 1);
4 4
 
5 5
 /**
6 6
  * balloon
Please login to merge, or discard this patch.
src/Exception/Configuration.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types=1);
3
+declare(strict_types = 1);
4 4
 
5 5
 /**
6 6
  * balloon
Please login to merge, or discard this patch.