Completed
Push — master ( d445b8...7f26e9 )
by James Ekow Abaka
02:00
created
src/InjectionContainer.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -20,10 +20,10 @@  discard block
 block discarded – undo
20 20
     public static function getResolvedClassName($class)
21 21
     {
22 22
         $bound = null;
23
-        if(self::getBindings()->has($class)) {
23
+        if (self::getBindings()->has($class)) {
24 24
             $bound = self::$bindings->get($class);
25 25
         }
26
-        else if(is_string($class) && class_exists($class)) {
26
+        else if (is_string($class) && class_exists($class)) {
27 27
             $bound = $class;
28 28
         }
29 29
         return $bound;
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
     
32 32
     private static function getBindings() 
33 33
     {
34
-        if(!self::$bindings) self::$bindings = new Bindings ();
34
+        if (!self::$bindings) self::$bindings = new Bindings();
35 35
         return self::$bindings;
36 36
     }
37 37
     
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
     
43 43
     public static function singleton($type)
44 44
     {
45
-        if(!isset(self::$singletons[$type])) {
45
+        if (!isset(self::$singletons[$type])) {
46 46
             self::$singletons[$type] = self::resolve($type);
47 47
         }
48 48
         return self::$singletons[$type];
@@ -51,11 +51,11 @@  discard block
 block discarded – undo
51 51
     public static function resolve($type)
52 52
     {
53 53
         $resolvedClass = self::getResolvedClassName($type);
54
-        if($resolvedClass=== null) {
54
+        if ($resolvedClass === null) {
55 55
             throw new exceptions\ResolutionException("Could not resolve dependency $type");
56 56
         }
57 57
         $reflection = new \ReflectionClass($resolvedClass);
58
-        if($reflection->isAbstract()) {
58
+        if ($reflection->isAbstract()) {
59 59
             throw new exceptions\ResolutionException(
60 60
                 "Abstract class {$reflection->getName()} cannot be instantiated. "
61 61
                 . "Please provide a binding to an implementation."
@@ -64,9 +64,9 @@  discard block
 block discarded – undo
64 64
         $constructor = $reflection->getConstructor();
65 65
         $instanceParameters = [];
66 66
         
67
-        if($constructor != null) {
67
+        if ($constructor != null) {
68 68
             $parameters = $constructor->getParameters();
69
-            foreach($parameters as $parameter) {
69
+            foreach ($parameters as $parameter) {
70 70
                 $class = $parameter->getClass();
71 71
                 $instanceParameters[] = $class ? self::resolve($class->getName()) : null;
72 72
             }            
Please login to merge, or discard this patch.
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -22,8 +22,7 @@  discard block
 block discarded – undo
22 22
         $bound = null;
23 23
         if(self::getBindings()->has($class)) {
24 24
             $bound = self::$bindings->get($class);
25
-        }
26
-        else if(is_string($class) && class_exists($class)) {
25
+        } else if(is_string($class) && class_exists($class)) {
27 26
             $bound = $class;
28 27
         }
29 28
         return $bound;
@@ -31,7 +30,9 @@  discard block
 block discarded – undo
31 30
     
32 31
     private static function getBindings() 
33 32
     {
34
-        if(!self::$bindings) self::$bindings = new Bindings ();
33
+        if(!self::$bindings) {
34
+            self::$bindings = new Bindings ();
35
+        }
35 36
         return self::$bindings;
36 37
     }
37 38
     
Please login to merge, or discard this patch.
src/ComponentContainerTrait.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
19 19
     
20 20
     protected function getComponentInstance($component)
21 21
     {
22
-        if(!isset($this->loadedComponents[$component])) {
22
+        if (!isset($this->loadedComponents[$component])) {
23 23
             $className = InjectionContainer::resolve(ComponentResolverInterface::class)
24 24
                 ->getComponentClassName($component, self::$resolverParameters);
25 25
             $componentInstance = InjectionContainer::resolve($className);
Please login to merge, or discard this patch.