@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | return $this->getSingletonInstance($type, $resolvedClass, $constructorArguments); |
53 | 53 | } |
54 | 54 | |
55 | - private function getSingletonInstance($type, $class, $constructorArguments) { |
|
55 | + private function getSingletonInstance($type, $class, $constructorArguments) { |
|
56 | 56 | if (!isset($this->singletons[$type])) { |
57 | 57 | $this->singletons[$type] = $this->getInstance($class, $constructorArguments); |
58 | 58 | } |
@@ -60,14 +60,14 @@ discard block |
||
60 | 60 | } |
61 | 61 | |
62 | 62 | public function resolve($type, $constructorArguments = []) { |
63 | - if($type === null) { |
|
63 | + if ($type === null) { |
|
64 | 64 | throw new exceptions\ResolutionException("Cannot resolve an empty type"); |
65 | 65 | } |
66 | 66 | $resolvedClass = $this->getResolvedClassName($type); |
67 | 67 | if ($resolvedClass['binding'] === null) { |
68 | 68 | throw new exceptions\ResolutionException("Could not resolve dependency $type"); |
69 | 69 | } |
70 | - if($resolvedClass['singleton'] ?? false) { |
|
70 | + if ($resolvedClass['singleton'] ?? false) { |
|
71 | 71 | return $this->getSingletonInstance($type, $resolvedClass['binding'], $constructorArguments); |
72 | 72 | } else { |
73 | 73 | return $this->getInstance($resolvedClass['binding'], $constructorArguments); |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | $className = $class ? $class->getName() : null; |
84 | 84 | if (isset($constructorArguments[$parameter->getName()])) { |
85 | 85 | $argumentValues[] = $constructorArguments[$parameter->getName()]; |
86 | - } else if($className == self::class){ |
|
86 | + } else if ($className == self::class) { |
|
87 | 87 | $argumentValues[] = $this; |
88 | 88 | } else { |
89 | 89 | $argumentValues[] = $className ? $this->resolve($className) : null; |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | if (is_callable($className)) { |
97 | 97 | return $className($this); |
98 | 98 | } |
99 | - if(is_object($className)) { |
|
99 | + if (is_object($className)) { |
|
100 | 100 | return $className; |
101 | 101 | } |
102 | 102 | $reflection = new \ReflectionClass($className); |
@@ -54,13 +54,13 @@ |
||
54 | 54 | |
55 | 55 | public function merge($bindings, $replace) |
56 | 56 | { |
57 | - foreach($bindings as $key => $binding) { |
|
58 | - if(isset($this->bindings[$key]) && !$replace) { |
|
57 | + foreach ($bindings as $key => $binding) { |
|
58 | + if (isset($this->bindings[$key]) && !$replace) { |
|
59 | 59 | continue; |
60 | 60 | } |
61 | - if(is_array($binding)) { |
|
61 | + if (is_array($binding)) { |
|
62 | 62 | $this->bindings[$key] = ['binding' => $binding[0]]; |
63 | - if(isset($binding['singleton'])) { |
|
63 | + if (isset($binding['singleton'])) { |
|
64 | 64 | $this->bindings[$key]['singleton'] = $binding['singleton']; |
65 | 65 | } |
66 | 66 | } else { |