@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | */ |
58 | 58 | public function to($value) |
59 | 59 | { |
60 | - if(isset($this->bindings[$this->activeKey])) { |
|
60 | + if (isset($this->bindings[$this->activeKey])) { |
|
61 | 61 | $this->bindings[$this->activeKey]['binding'] = $value; |
62 | 62 | } else { |
63 | 63 | $this->bindings[$this->activeKey] = ['binding' => $value, 'calls' => [], 'properties' => []]; |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | public function get(string $key) |
75 | 75 | { |
76 | 76 | $binding = $this->bindings[$key]; |
77 | - if(!isset($binding['binding'])) { |
|
77 | + if (!isset($binding['binding'])) { |
|
78 | 78 | $binding['binding'] = $key; |
79 | 79 | } |
80 | 80 | return $binding; |
@@ -108,16 +108,16 @@ discard block |
||
108 | 108 | */ |
109 | 109 | private function setArrayBinding(array $binding) |
110 | 110 | { |
111 | - if(isset($binding[0])) { |
|
111 | + if (isset($binding[0])) { |
|
112 | 112 | $this->to($binding[0]); |
113 | 113 | } |
114 | 114 | |
115 | - if(isset($binding['calls'])){ |
|
116 | - foreach($binding['calls'] as $key => $call) { |
|
117 | - if(is_string($call)) { |
|
115 | + if (isset($binding['calls'])) { |
|
116 | + foreach ($binding['calls'] as $key => $call) { |
|
117 | + if (is_string($call)) { |
|
118 | 118 | $method = $call; |
119 | 119 | $parameters = []; |
120 | - } else if(is_array($call)) { |
|
120 | + } else if (is_array($call)) { |
|
121 | 121 | $method = $key; |
122 | 122 | $parameters = $call; |
123 | 123 | } |
@@ -137,9 +137,9 @@ discard block |
||
137 | 137 | */ |
138 | 138 | public function merge(array $bindings) |
139 | 139 | { |
140 | - foreach($bindings as $key => $binding) { |
|
140 | + foreach ($bindings as $key => $binding) { |
|
141 | 141 | $this->activeKey = $key; |
142 | - if(is_array($binding)) { |
|
142 | + if (is_array($binding)) { |
|
143 | 143 | $this->setArrayBinding($binding); |
144 | 144 | } else { |
145 | 145 | $this->bindings[$key] = ['binding' => $binding, 'calls' => [], 'properties' => []]; |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | $instance = $this->getInstance($resolvedClass['binding'], $resolvedClass['args'] ?? $constructorArguments); |
105 | 105 | } |
106 | 106 | |
107 | - foreach($resolvedClass['calls'] ?? [] as $calls) { |
|
107 | + foreach ($resolvedClass['calls'] ?? [] as $calls) { |
|
108 | 108 | $method = new \ReflectionMethod($instance, $calls[0]); |
109 | 109 | $method->invokeArgs($instance, $this->getMethodArguments($method, $calls[1])); |
110 | 110 | } |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | */ |
137 | 137 | private function resolveArgument($argument, $class) |
138 | 138 | { |
139 | - if($class && is_string($argument)) { |
|
139 | + if ($class && is_string($argument)) { |
|
140 | 140 | return $this->resolve($argument); |
141 | 141 | } |
142 | 142 | return $argument; |
@@ -160,8 +160,7 @@ discard block |
||
160 | 160 | if (isset($methodArguments[$parameter->getName()])) { |
161 | 161 | $argumentValues[] = $this->resolveArgument($methodArguments[$parameter->getName()], $className); |
162 | 162 | } else { |
163 | - $argumentValues[] = $className ? $this->resolve($className) : |
|
164 | - ($parameter->isDefaultValueAvailable() ? $parameter->getDefaultValue() : null); |
|
163 | + $argumentValues[] = $className ? $this->resolve($className) : ($parameter->isDefaultValueAvailable() ? $parameter->getDefaultValue() : null); |
|
165 | 164 | } |
166 | 165 | } |
167 | 166 | return $argumentValues; |