@@ -119,14 +119,14 @@ discard block |
||
| 119 | 119 | // creating a resolving callback that in every call will recalculate all dependencies |
| 120 | 120 | // for the given class, and offcourse, using a cached resolving callback if exists. |
| 121 | 121 | |
| 122 | - return function (string $abstract, array $parameters) use ($inspector, $dependencies) { |
|
| 122 | + return function(string $abstract, array $parameters) use ($inspector, $dependencies) { |
|
| 123 | 123 | return $inspector->newInstanceArgs( |
| 124 | 124 | $this->process($abstract, $parameters, $dependencies) |
| 125 | 125 | ); |
| 126 | 126 | }; |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | - return function (string $abstract) { |
|
| 129 | + return function(string $abstract) { |
|
| 130 | 130 | return new $abstract; |
| 131 | 131 | }; |
| 132 | 132 | } |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | { |
| 168 | 168 | $key = $abstract.$dependency->name; |
| 169 | 169 | |
| 170 | - if (! isset($this->resolved[$key])) { |
|
| 170 | + if (!isset($this->resolved[$key])) { |
|
| 171 | 171 | $this->resolved[$key] = $this->generate($abstract, $dependency); |
| 172 | 172 | } |
| 173 | 173 | |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | return $this->dependencies[$key]; |
| 195 | 195 | } |
| 196 | 196 | |
| 197 | - return function () use ($classname) { |
|
| 197 | + return function() use ($classname) { |
|
| 198 | 198 | return $this->make($classname); |
| 199 | 199 | }; |
| 200 | 200 | } |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | try { |
| 203 | 203 | $value = $dependency->getDefaultValue(); |
| 204 | 204 | |
| 205 | - return function () use ($value) { |
|
| 205 | + return function() use ($value) { |
|
| 206 | 206 | return $value; |
| 207 | 207 | }; |
| 208 | 208 | } catch (ReflectionException $e) { |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | */ |
| 239 | 239 | public function get($abstract) |
| 240 | 240 | { |
| 241 | - if (! isset($this->collection[$abstract])) { |
|
| 241 | + if (!isset($this->collection[$abstract])) { |
|
| 242 | 242 | throw new NotFoundException("Element '$abstract' not found"); |
| 243 | 243 | } |
| 244 | 244 | |
@@ -310,7 +310,7 @@ discard block |
||
| 310 | 310 | } |
| 311 | 311 | |
| 312 | 312 | if ($concrete instanceof Closure === false) { |
| 313 | - $concrete = function (Container $container) use ($concrete) { |
|
| 313 | + $concrete = function(Container $container) use ($concrete) { |
|
| 314 | 314 | return $container->make($concrete); |
| 315 | 315 | }; |
| 316 | 316 | } |
@@ -334,7 +334,7 @@ discard block |
||
| 334 | 334 | |
| 335 | 335 | public function setIf(string $abstract, $concrete, bool $shared = false) : self |
| 336 | 336 | { |
| 337 | - if (! isset($this->collection[$abstract])) { |
|
| 337 | + if (!isset($this->collection[$abstract])) { |
|
| 338 | 338 | $this->set($abstract, $concrete, $shared); |
| 339 | 339 | } |
| 340 | 340 | |
@@ -355,11 +355,11 @@ discard block |
||
| 355 | 355 | { |
| 356 | 356 | if ($dependency instanceof Closure === false) { |
| 357 | 357 | if (is_object($dependency)) { |
| 358 | - $dependency = function () use ($dependency) { |
|
| 358 | + $dependency = function() use ($dependency) { |
|
| 359 | 359 | return $dependency; |
| 360 | 360 | }; |
| 361 | 361 | } else { |
| 362 | - $dependency = function () use ($dependency) { |
|
| 362 | + $dependency = function() use ($dependency) { |
|
| 363 | 363 | return $this->get($dependency); |
| 364 | 364 | }; |
| 365 | 365 | } |
@@ -399,8 +399,8 @@ discard block |
||
| 399 | 399 | |
| 400 | 400 | public function instance(string $abstract, $instance) : self |
| 401 | 401 | { |
| 402 | - if (! is_object($instance)) { |
|
| 403 | - throw new ContainerException('Trying to store ' . gettype($type) . ' as object.'); |
|
| 402 | + if (!is_object($instance)) { |
|
| 403 | + throw new ContainerException('Trying to store '.gettype($type).' as object.'); |
|
| 404 | 404 | } |
| 405 | 405 | |
| 406 | 406 | $this->collection[$abstract] = $instance; |
@@ -420,14 +420,14 @@ discard block |
||
| 420 | 420 | |
| 421 | 421 | public function extend(string $abstract, closure $extension) : self |
| 422 | 422 | { |
| 423 | - if (! isset($this->collection[$abstract])) { |
|
| 423 | + if (!isset($this->collection[$abstract])) { |
|
| 424 | 424 | throw new NotFoundException($abstract); |
| 425 | 425 | } |
| 426 | 426 | |
| 427 | 427 | $object = $this->collection[$abstract]; |
| 428 | 428 | |
| 429 | 429 | if ($object instanceof Closure) { |
| 430 | - $this->collection[$abstract] = function () use ($object, $extension) { |
|
| 430 | + $this->collection[$abstract] = function() use ($object, $extension) { |
|
| 431 | 431 | return $extension($object($this), $this); |
| 432 | 432 | }; |
| 433 | 433 | } else { |
@@ -450,11 +450,11 @@ discard block |
||
| 450 | 450 | |
| 451 | 451 | public function share(string $abstract) : self |
| 452 | 452 | { |
| 453 | - if (! isset($this->collection[$abstract])) { |
|
| 453 | + if (!isset($this->collection[$abstract])) { |
|
| 454 | 454 | throw new NotFoundException("Element '$abstract' not found"); |
| 455 | 455 | } |
| 456 | 456 | |
| 457 | - if (! $this->collection[$abstract] instanceof Closure) { |
|
| 457 | + if (!$this->collection[$abstract] instanceof Closure) { |
|
| 458 | 458 | throw new ContainerException("'$abstract' must be a resolvable element"); |
| 459 | 459 | } |
| 460 | 460 | |