Completed
Branch master (3774b7)
by Alex
03:54 queued 01:54
created
src/Container.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
         }
327 327
 
328 328
         if ($concrete instanceof Closure === false) {
329
-            $concrete = function (Container $container) use ($concrete) {
329
+            $concrete = function(Container $container) use ($concrete) {
330 330
                 return $container->make($concrete);
331 331
             };
332 332
         }
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
 
351 351
     public function setIf(string $abstract, $concrete, bool $shared = false) : ContainerInterface
352 352
     {
353
-        if (! isset($this->collection[$abstract])) {
353
+        if (!isset($this->collection[$abstract])) {
354 354
             $this->set($abstract, $concrete, $shared);
355 355
         }
356 356
 
@@ -371,11 +371,11 @@  discard block
 block discarded – undo
371 371
     {
372 372
         if ($dependency instanceof Closure === false) {
373 373
             if (is_object($dependency)) {
374
-                $dependency = function () use ($dependency) {
374
+                $dependency = function() use ($dependency) {
375 375
                     return $dependency;
376 376
                 };
377 377
             } else {
378
-                $dependency = function () use ($dependency) {
378
+                $dependency = function() use ($dependency) {
379 379
                     return $this->get($dependency);
380 380
                 };
381 381
             }
@@ -415,8 +415,8 @@  discard block
 block discarded – undo
415 415
 
416 416
     public function instance(string $abstract, $instance) : ContainerInterface
417 417
     {
418
-        if (! is_object($instance)) {
419
-            throw new ContainerException('Trying to store ' . gettype($instance) . ' as object.');
418
+        if (!is_object($instance)) {
419
+            throw new ContainerException('Trying to store '.gettype($instance).' as object.');
420 420
         }
421 421
 
422 422
         $this->collection[$abstract] = $instance;
Please login to merge, or discard this patch.