Completed
Push — master ( bee542...31e600 )
by James Ekow Abaka
01:58
created
src/Container.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
         return $this->getSingletonInstance($type, $resolvedClass, $constructorArguments);
41 41
     }
42 42
     
43
-    private function getSingletonInstance($type, $class,  $constructorArguments) {
43
+    private function getSingletonInstance($type, $class, $constructorArguments) {
44 44
         if (!isset($this->singletons[$type])) {
45 45
             $this->singletons[$type] = $this->getInstance($class, $constructorArguments);
46 46
         }
@@ -48,14 +48,14 @@  discard block
 block discarded – undo
48 48
     }
49 49
     
50 50
     public function resolve($type, $constructorArguments = []) {
51
-        if($type === null) {
51
+        if ($type === null) {
52 52
             throw new exceptions\ResolutionException("Cannot resolve an empty type");
53 53
         } 
54 54
         $resolvedClass = $this->getResolvedClassName($type);
55 55
         if ($resolvedClass['class'] === null) {
56 56
             throw new exceptions\ResolutionException("Could not resolve dependency $type");
57 57
         }           
58
-        if(isset($resolvedClass['singleton'])) {
58
+        if (isset($resolvedClass['singleton'])) {
59 59
             return $this->getSingletonInstance($type, $resolvedClass['class'], $constructorArguments);
60 60
         } else {
61 61
             return $this->getInstance($resolvedClass['class'], $constructorArguments);
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
     }
64 64
 
65 65
     public function getInstance($className, $constructorArguments = []) {
66
-        if(is_object($className)) {
66
+        if (is_object($className)) {
67 67
             return $className;
68 68
         }
69 69
         $reflection = new \ReflectionClass($className);
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
                 $className = $class ? $class->getName() : null;
84 84
                 if (isset($constructorArguments[$parameter->getName()])) {
85 85
                     $instanceParameters[] = $constructorArguments[$parameter->getName()];
86
-                } else if($className == self::class){
86
+                } else if ($className == self::class) {
87 87
                     $instanceParameters[] = $this;
88 88
                 } else {                    
89 89
                     $instanceParameters[] = $className ? $this->resolve($className) : null;
Please login to merge, or discard this patch.