Completed
Push — master ( 4a08fa...139841 )
by Alex
02:02
created
src/Container.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
         if ($constructor  = $inspector->getConstructor()) {
131 131
             $dependencies = $constructor->getParameters();
132 132
 
133
-            return function (string $abstract, array $parameters) use ($inspector, $dependencies, $force) {
133
+            return function(string $abstract, array $parameters) use ($inspector, $dependencies, $force) {
134 134
                 $resolvedClassParameters = [];
135 135
 
136 136
                 foreach ($dependencies as $dependency) {
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
             };
144 144
         }
145 145
 
146
-        return function (string $abstract) {
146
+        return function(string $abstract) {
147 147
             return new $abstract;
148 148
         };
149 149
     }
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
     {
163 163
         $key = $abstract.$dependency->name;
164 164
 
165
-        if (! isset($this->resolved[$key]) || $force === true) {
165
+        if (!isset($this->resolved[$key]) || $force === true) {
166 166
             $this->resolved[$key] = $this->generate($abstract, $dependency);
167 167
         }
168 168
 
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
                 return $this->dependencies[$key];
189 189
             }
190 190
 
191
-            return function () use ($classname) {
191
+            return function() use ($classname) {
192 192
                 return $this->make($classname);
193 193
             };
194 194
         }
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
      */
225 225
     public function get($abstract)
226 226
     {
227
-        if (! isset($this->collection[$abstract])) {
227
+        if (!isset($this->collection[$abstract])) {
228 228
             throw new Exceptions\NotFoundException("Element '$abstract' not found");
229 229
         }
230 230
 
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
         }
297 297
 
298 298
         if ($concrete instanceof Closure === false) {
299
-            $concrete = function (Container $container) use ($concrete) {
299
+            $concrete = function(Container $container) use ($concrete) {
300 300
                 return $container->make($concrete);
301 301
             };
302 302
         }
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
 
321 321
     public function setIf(string $abstract, $concrete, bool $shared = false) : self
322 322
     {
323
-        if (! isset($this->collection[$abstract])) {
323
+        if (!isset($this->collection[$abstract])) {
324 324
             $this->set($abstract, $concrete, $shared);
325 325
         }
326 326
 
@@ -341,11 +341,11 @@  discard block
 block discarded – undo
341 341
     {
342 342
         if ($dependency instanceof Closure === false) {
343 343
             if (is_object($dependency)) {
344
-                $dependency = function () use ($dependency) {
344
+                $dependency = function() use ($dependency) {
345 345
                     return $dependency;
346 346
                 };
347 347
             } else {
348
-                $dependency = function () use ($dependency) {
348
+                $dependency = function() use ($dependency) {
349 349
                     return $this->get($dependency);
350 350
                 };
351 351
             }
@@ -385,8 +385,8 @@  discard block
 block discarded – undo
385 385
 
386 386
     public function instance(string $abstract, $instance) : self
387 387
     {
388
-        if (! is_object($instance)) {
389
-            throw new Exceptions\ContainerException('Trying to store ' . gettype($type) . ' as object.');
388
+        if (!is_object($instance)) {
389
+            throw new Exceptions\ContainerException('Trying to store '.gettype($type).' as object.');
390 390
         }
391 391
 
392 392
         $this->collection[$abstract] = $instance;
@@ -406,14 +406,14 @@  discard block
 block discarded – undo
406 406
 
407 407
     public function extend(string $abstract, closure $extension) : self
408 408
     {
409
-        if (! isset($this->collection[$abstract])) {
409
+        if (!isset($this->collection[$abstract])) {
410 410
             throw new Exceptions\NotFoundException;
411 411
         }
412 412
 
413 413
         $object = $this->collection[$abstract];
414 414
 
415 415
         if ($object instanceof Closure) {
416
-            $this->collection[$abstract] = function () use ($object, $extension) {
416
+            $this->collection[$abstract] = function() use ($object, $extension) {
417 417
                 return $extension($object($this), $this);
418 418
             };
419 419
         } else {
@@ -436,11 +436,11 @@  discard block
 block discarded – undo
436 436
 
437 437
     public function share(string $abstract) : self
438 438
     {
439
-        if (! isset($this->collection[$abstract])) {
439
+        if (!isset($this->collection[$abstract])) {
440 440
             throw new Exceptions\NotFoundException("Element '$abstract' not found");
441 441
         }
442 442
 
443
-        if (! $this->collection[$abstract] instanceof Closure) {
443
+        if (!$this->collection[$abstract] instanceof Closure) {
444 444
             throw new Exceptions\ContainerException("'$abstract' must be a resolvable element");
445 445
         }
446 446
 
Please login to merge, or discard this patch.