Completed
Push — master ( fbcbc0...dcd501 )
by James Ekow Abaka
02:29
created
src/InjectionContainer.php 1 patch
Spacing   +9 added lines, -9 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, $constructorArguments = [])
44 44
     {
45
-        if(!isset(self::$singletons[$type])) {
45
+        if (!isset(self::$singletons[$type])) {
46 46
             self::$singletons[$type] = self::resolve($type, $constructorArguments);
47 47
         }
48 48
         return self::$singletons[$type];
@@ -51,11 +51,11 @@  discard block
 block discarded – undo
51 51
     public static function resolve($type, $constructorArguments = [])
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,11 +64,11 @@  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
-                if(isset($constructorArguments[$parameter->getName()])) {
71
+                if (isset($constructorArguments[$parameter->getName()])) {
72 72
                     $instanceParameters[] = $constructorArguments[$parameter->getName()];
73 73
                 } else {
74 74
                     $instanceParameters[] = $class ? self::resolve($class->getName()) : null;
Please login to merge, or discard this patch.