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