@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | * because it is aways needed. |
19 | 19 | */ |
20 | 20 | |
21 | -require_once __DIR__ . '/ContainerInterface.php'; |
|
21 | +require_once __DIR__.'/ContainerInterface.php'; |
|
22 | 22 | |
23 | 23 | /** |
24 | 24 | * The container class is reponsable to construct all objects |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | public function make(string $abstract, array $parameters = []) |
96 | 96 | { |
97 | 97 | try { |
98 | - if (! isset($this->resolving[$abstract])) { |
|
98 | + if (!isset($this->resolving[$abstract])) { |
|
99 | 99 | $this->resolving[$abstract] = $this->construct($abstract); |
100 | 100 | } |
101 | 101 | |
@@ -124,14 +124,14 @@ discard block |
||
124 | 124 | // creating a resolving callback that in every call will recalculate all dependencies |
125 | 125 | // for the given class, and offcourse, using a cached resolving callback if exists. |
126 | 126 | |
127 | - return function (string $abstract, array $parameters) use ($inspector, $dependencies) { |
|
127 | + return function(string $abstract, array $parameters) use ($inspector, $dependencies) { |
|
128 | 128 | return $inspector->newInstanceArgs( |
129 | 129 | $this->process($abstract, $parameters, $dependencies) |
130 | 130 | ); |
131 | 131 | }; |
132 | 132 | } |
133 | 133 | |
134 | - return function (string $abstract) { |
|
134 | + return function(string $abstract) { |
|
135 | 135 | return new $abstract; |
136 | 136 | }; |
137 | 137 | } |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | { |
173 | 173 | $key = $abstract.$dependency->name; |
174 | 174 | |
175 | - if (! isset($this->resolved[$key])) { |
|
175 | + if (!isset($this->resolved[$key])) { |
|
176 | 176 | $this->resolved[$key] = $this->generate($abstract, $dependency); |
177 | 177 | } |
178 | 178 | |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | try { |
199 | 199 | $value = $dependency->getDefaultValue(); |
200 | 200 | |
201 | - return function () use ($value) { |
|
201 | + return function() use ($value) { |
|
202 | 202 | return $value; |
203 | 203 | }; |
204 | 204 | } catch (ReflectionException $e) { |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | return $this->dependencies[$entry]; |
222 | 222 | } |
223 | 223 | |
224 | - return function () use ($classname) { |
|
224 | + return function() use ($classname) { |
|
225 | 225 | return $this->make($classname); |
226 | 226 | }; |
227 | 227 | } |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | */ |
255 | 255 | public function get($abstract) |
256 | 256 | { |
257 | - if (! isset($this->collection[$abstract])) { |
|
257 | + if (!isset($this->collection[$abstract])) { |
|
258 | 258 | throw new NotFoundException("Element '$abstract' not found"); |
259 | 259 | } |
260 | 260 | |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | |
298 | 298 | public function isSingleton(string $abstract) : bool |
299 | 299 | { |
300 | - if (! $this->has($abstract)) { |
|
300 | + if (!$this->has($abstract)) { |
|
301 | 301 | throw new NotFoundException("Element '$abstract' not found"); |
302 | 302 | } |
303 | 303 | |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | |
316 | 316 | public function isInstance(string $abstract) : bool |
317 | 317 | { |
318 | - if (! $this->has($abstract)) { |
|
318 | + if (!$this->has($abstract)) { |
|
319 | 319 | throw new NotFoundException("Element '$abstract' not found"); |
320 | 320 | } |
321 | 321 | |
@@ -339,7 +339,7 @@ discard block |
||
339 | 339 | } |
340 | 340 | |
341 | 341 | if ($concrete instanceof Closure === false) { |
342 | - $concrete = function (Container $container) use ($concrete) { |
|
342 | + $concrete = function(Container $container) use ($concrete) { |
|
343 | 343 | return $container->make($concrete); |
344 | 344 | }; |
345 | 345 | } |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | |
364 | 364 | public function setIf(string $abstract, $concrete, bool $shared = false) : ContainerInterface |
365 | 365 | { |
366 | - if (! $this->has($abstract)) { |
|
366 | + if (!$this->has($abstract)) { |
|
367 | 367 | $this->set($abstract, $concrete, $shared); |
368 | 368 | } |
369 | 369 | |
@@ -384,11 +384,11 @@ discard block |
||
384 | 384 | { |
385 | 385 | if ($dependency instanceof Closure === false) { |
386 | 386 | if (is_object($dependency)) { |
387 | - $dependency = function () use ($dependency) { |
|
387 | + $dependency = function() use ($dependency) { |
|
388 | 388 | return $dependency; |
389 | 389 | }; |
390 | 390 | } else { |
391 | - $dependency = function () use ($dependency) { |
|
391 | + $dependency = function() use ($dependency) { |
|
392 | 392 | return $this->get($dependency); |
393 | 393 | }; |
394 | 394 | } |
@@ -428,8 +428,8 @@ discard block |
||
428 | 428 | |
429 | 429 | public function instance(string $abstract, $instance) : ContainerInterface |
430 | 430 | { |
431 | - if (! is_object($instance)) { |
|
432 | - throw new ContainerException('Trying to store ' . gettype($instance) . ' as object.'); |
|
431 | + if (!is_object($instance)) { |
|
432 | + throw new ContainerException('Trying to store '.gettype($instance).' as object.'); |
|
433 | 433 | } |
434 | 434 | |
435 | 435 | $this->collection[$abstract] = $instance; |