@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | $inspector = new ReflectionClass($abstract); |
126 | 126 | |
127 | 127 | if ($constructor = $inspector->getConstructor() and $dependencies = $constructor->getParameters()) { |
128 | - return function (string $abstract, array $parameters) use ($inspector, $dependencies, $force) { |
|
128 | + return function(string $abstract, array $parameters) use ($inspector, $dependencies, $force) { |
|
129 | 129 | $resolvedClassDependencies = []; |
130 | 130 | |
131 | 131 | foreach ($dependencies as $dependency) { |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | }; |
139 | 139 | } |
140 | 140 | |
141 | - return function (string $abstract, array $parameters) { |
|
141 | + return function(string $abstract, array $parameters) { |
|
142 | 142 | return new $abstract; |
143 | 143 | }; |
144 | 144 | } |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | { |
158 | 158 | $key = $abstract.$dependency->name; |
159 | 159 | |
160 | - if (! isset($this->resolved[$key]) || $force === true) { |
|
160 | + if (!isset($this->resolved[$key]) || $force === true) { |
|
161 | 161 | $this->resolved[$key] = $this->generate($abstract, $dependency); |
162 | 162 | } |
163 | 163 | |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | return $this->dependencies[$key]; |
185 | 185 | } |
186 | 186 | |
187 | - return function () use ($classname) { |
|
187 | + return function() use ($classname) { |
|
188 | 188 | return $this->make($classname); |
189 | 189 | }; |
190 | 190 | } |
@@ -192,11 +192,11 @@ discard block |
||
192 | 192 | try { |
193 | 193 | $value = $dependency->getDefaultValue(); |
194 | 194 | |
195 | - return function () use ($value) { |
|
195 | + return function() use ($value) { |
|
196 | 196 | return $value; |
197 | 197 | }; |
198 | 198 | } catch (ReflectionException $e) { |
199 | - throw new ContainerException("Cannot resolve '" . $dependency->getName() . "' of '$abstract'", 0, $e); |
|
199 | + throw new ContainerException("Cannot resolve '".$dependency->getName()."' of '$abstract'", 0, $e); |
|
200 | 200 | } |
201 | 201 | } |
202 | 202 | |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | */ |
229 | 229 | public function get($abstract) |
230 | 230 | { |
231 | - if (! isset($this->collection[$abstract])) { |
|
231 | + if (!isset($this->collection[$abstract])) { |
|
232 | 232 | throw new NotFoundException("Element '$abstract' not found"); |
233 | 233 | } |
234 | 234 | |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | } |
301 | 301 | |
302 | 302 | if ($concrete instanceof Closure === false) { |
303 | - $concrete = function (Container $container) use ($concrete) { |
|
303 | + $concrete = function(Container $container) use ($concrete) { |
|
304 | 304 | return $container->make($concrete); |
305 | 305 | }; |
306 | 306 | } |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | |
325 | 325 | public function setIf(string $abstract, $concrete, bool $shared = false) : self |
326 | 326 | { |
327 | - if (! isset($this->collection[$abstract])) { |
|
327 | + if (!isset($this->collection[$abstract])) { |
|
328 | 328 | $this->set($abstract, $concrete, $shared); |
329 | 329 | } |
330 | 330 | |
@@ -345,11 +345,11 @@ discard block |
||
345 | 345 | { |
346 | 346 | if ($dependency instanceof Closure === false) { |
347 | 347 | if (is_object($dependency)) { |
348 | - $dependency = function () use ($dependency) { |
|
348 | + $dependency = function() use ($dependency) { |
|
349 | 349 | return $dependency; |
350 | 350 | }; |
351 | 351 | } else { |
352 | - $dependency = function () use ($dependency) { |
|
352 | + $dependency = function() use ($dependency) { |
|
353 | 353 | return $this->get($dependency); |
354 | 354 | }; |
355 | 355 | } |
@@ -389,8 +389,8 @@ discard block |
||
389 | 389 | |
390 | 390 | public function instance(string $abstract, $instance) : self |
391 | 391 | { |
392 | - if (! is_object($instance)) { |
|
393 | - throw new ContainerException('Trying to store ' . gettype($type) . ' as object.'); |
|
392 | + if (!is_object($instance)) { |
|
393 | + throw new ContainerException('Trying to store '.gettype($type).' as object.'); |
|
394 | 394 | } |
395 | 395 | |
396 | 396 | $this->collection[$abstract] = $instance; |
@@ -410,14 +410,14 @@ discard block |
||
410 | 410 | |
411 | 411 | public function extend(string $abstract, closure $extension) : self |
412 | 412 | { |
413 | - if (! isset($this->collection[$abstract])) { |
|
413 | + if (!isset($this->collection[$abstract])) { |
|
414 | 414 | throw new NotFoundException; |
415 | 415 | } |
416 | 416 | |
417 | 417 | $object = $this->collection[$abstract]; |
418 | 418 | |
419 | 419 | if ($object instanceof Closure) { |
420 | - $this->collection[$abstract] = function () use ($object, $extension) { |
|
420 | + $this->collection[$abstract] = function() use ($object, $extension) { |
|
421 | 421 | return $extension($object($this), $this); |
422 | 422 | }; |
423 | 423 | } else { |
@@ -440,11 +440,11 @@ discard block |
||
440 | 440 | |
441 | 441 | public function share(string $abstract) : self |
442 | 442 | { |
443 | - if (! isset($this->collection[$abstract])) { |
|
443 | + if (!isset($this->collection[$abstract])) { |
|
444 | 444 | throw new NotFoundException("Element '$abstract' not found"); |
445 | 445 | } |
446 | 446 | |
447 | - if (! $this->collection[$abstract] instanceof Closure) { |
|
447 | + if (!$this->collection[$abstract] instanceof Closure) { |
|
448 | 448 | throw new ContainerException("'$abstract' must be a resolvable element"); |
449 | 449 | } |
450 | 450 |