Passed
Push — master ( ab0d76...0f78eb )
by Alex
02:02
created
src/Container.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
  * because it is aways needed.
20 20
  */
21 21
 
22
-require_once __DIR__ . '/ContainerInterface.php';
22
+require_once __DIR__.'/ContainerInterface.php';
23 23
 
24 24
 /**
25 25
  * The container class is reponsable to construct all objects
@@ -126,14 +126,14 @@  discard block
 block discarded – undo
126 126
             // creating a resolving callback that in every call will recalculate all dependencies
127 127
             // for the given class, and offcourse, using a cached resolving callback if exists.
128 128
 
129
-            return function (string $abstract, array $parameters) use ($inspector, $dependencies) {
129
+            return function(string $abstract, array $parameters) use ($inspector, $dependencies) {
130 130
                 return $inspector->newInstanceArgs(
131 131
                     $this->process($abstract, $parameters, $dependencies)
132 132
                 );
133 133
             };
134 134
         }
135 135
 
136
-        return function (string $abstract) {
136
+        return function(string $abstract) {
137 137
             return new $abstract;
138 138
         };
139 139
     }
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
     {
175 175
         $key = $abstract.$dependency->name;
176 176
 
177
-        if (! isset($this->resolved[$key])) {
177
+        if (!isset($this->resolved[$key])) {
178 178
             $this->resolved[$key] = $this->generate($abstract, $dependency);
179 179
         }
180 180
 
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
         try {
201 201
             $value = $dependency->getDefaultValue();
202 202
 
203
-            return function () use ($value) {
203
+            return function() use ($value) {
204 204
                 return $value;
205 205
             };
206 206
         } catch (ReflectionException $e) {
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
             return $this->dependencies[$entry];
224 224
         }
225 225
 
226
-        return function () use ($classname) {
226
+        return function() use ($classname) {
227 227
             return $this->make($classname);
228 228
         };
229 229
     }
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
      */
257 257
     public function get($abstract)
258 258
     {
259
-        if (! isset($this->collection[$abstract])) {
259
+        if (!isset($this->collection[$abstract])) {
260 260
             throw new NotFoundException("Element '$abstract' not found");
261 261
         }
262 262
 
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
         }
329 329
 
330 330
         if ($concrete instanceof Closure === false) {
331
-            $concrete = function (Container $container) use ($concrete) {
331
+            $concrete = function(Container $container) use ($concrete) {
332 332
                 return $container->make($concrete);
333 333
             };
334 334
         }
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
 
353 353
     public function setIf(string $abstract, $concrete, bool $shared = false) : self
354 354
     {
355
-        if (! isset($this->collection[$abstract])) {
355
+        if (!isset($this->collection[$abstract])) {
356 356
             $this->set($abstract, $concrete, $shared);
357 357
         }
358 358
 
@@ -373,11 +373,11 @@  discard block
 block discarded – undo
373 373
     {
374 374
         if ($dependency instanceof Closure === false) {
375 375
             if (is_object($dependency)) {
376
-                $dependency = function () use ($dependency) {
376
+                $dependency = function() use ($dependency) {
377 377
                     return $dependency;
378 378
                 };
379 379
             } else {
380
-                $dependency = function () use ($dependency) {
380
+                $dependency = function() use ($dependency) {
381 381
                     return $this->get($dependency);
382 382
                 };
383 383
             }
@@ -417,8 +417,8 @@  discard block
 block discarded – undo
417 417
 
418 418
     public function instance(string $abstract, $instance) : self
419 419
     {
420
-        if (! is_object($instance)) {
421
-            throw new ContainerException('Trying to store ' . gettype($type) . ' as object.');
420
+        if (!is_object($instance)) {
421
+            throw new ContainerException('Trying to store '.gettype($type).' as object.');
422 422
         }
423 423
 
424 424
         $this->collection[$abstract] = $instance;
@@ -438,14 +438,14 @@  discard block
 block discarded – undo
438 438
 
439 439
     public function extend(string $abstract, closure $extension) : self
440 440
     {
441
-        if (! isset($this->collection[$abstract])) {
441
+        if (!isset($this->collection[$abstract])) {
442 442
             throw new NotFoundException($abstract);
443 443
         }
444 444
 
445 445
         $object = $this->collection[$abstract];
446 446
 
447 447
         if ($object instanceof Closure) {
448
-            $this->collection[$abstract] = function () use ($object, $extension) {
448
+            $this->collection[$abstract] = function() use ($object, $extension) {
449 449
                 return $extension($object($this), $this);
450 450
             };
451 451
         } else {
@@ -468,11 +468,11 @@  discard block
 block discarded – undo
468 468
 
469 469
     public function share(string $abstract) : self
470 470
     {
471
-        if (! isset($this->collection[$abstract])) {
471
+        if (!isset($this->collection[$abstract])) {
472 472
             throw new NotFoundException("Element '$abstract' not found");
473 473
         }
474 474
 
475
-        if (! $this->collection[$abstract] instanceof Closure) {
475
+        if (!$this->collection[$abstract] instanceof Closure) {
476 476
             throw new ContainerException("'$abstract' must be a resolvable element");
477 477
         }
478 478
 
Please login to merge, or discard this patch.