@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | $instance = $this->getInstance($resolvedClass['binding'], $constructorArguments); |
101 | 101 | } |
102 | 102 | |
103 | - foreach($resolvedClass['calls'] ?? [] as $calls) { |
|
103 | + foreach ($resolvedClass['calls'] ?? [] as $calls) { |
|
104 | 104 | $method = new \ReflectionMethod($instance, $calls[0]); |
105 | 105 | $method->invokeArgs($instance, $this->getMethodArguments($method, $calls[1])); |
106 | 106 | } |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | */ |
131 | 131 | private function resolveArgument($argument, $class) |
132 | 132 | { |
133 | - if($class && is_string($argument)) { |
|
133 | + if ($class && is_string($argument)) { |
|
134 | 134 | return $this->resolve($argument); |
135 | 135 | } |
136 | 136 | return $argument; |
@@ -153,8 +153,7 @@ discard block |
||
153 | 153 | if (isset($methodArguments[$parameter->getName()])) { |
154 | 154 | $argumentValues[] = $this->resolveArgument($methodArguments[$parameter->getName()], $className); |
155 | 155 | } else { |
156 | - $argumentValues[] = $className ? $this->resolve($className) : |
|
157 | - ($parameter->isDefaultValueAvailable() ? $parameter->getDefaultValue() : null); |
|
156 | + $argumentValues[] = $className ? $this->resolve($className) : ($parameter->isDefaultValueAvailable() ? $parameter->getDefaultValue() : null); |
|
158 | 157 | } |
159 | 158 | } |
160 | 159 | return $argumentValues; |
@@ -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' => []]; |
@@ -104,13 +104,13 @@ discard block |
||
104 | 104 | */ |
105 | 105 | private function setArrayBinding(array $binding) |
106 | 106 | { |
107 | - if(isset($binding[0])) { |
|
107 | + if (isset($binding[0])) { |
|
108 | 108 | $this->to($binding[0]); |
109 | 109 | } |
110 | 110 | |
111 | - if(isset($binding['calls'])){ |
|
112 | - foreach($binding['calls'] as $call => $parameters) { |
|
113 | - if(is_numeric($call)) { |
|
111 | + if (isset($binding['calls'])) { |
|
112 | + foreach ($binding['calls'] as $call => $parameters) { |
|
113 | + if (is_numeric($call)) { |
|
114 | 114 | $call = $parameters; |
115 | 115 | $parameters = []; |
116 | 116 | } |
@@ -130,9 +130,9 @@ discard block |
||
130 | 130 | */ |
131 | 131 | public function merge(array $bindings) |
132 | 132 | { |
133 | - foreach($bindings as $key => $binding) { |
|
133 | + foreach ($bindings as $key => $binding) { |
|
134 | 134 | $this->activeKey = $key; |
135 | - if(is_array($binding)) { |
|
135 | + if (is_array($binding)) { |
|
136 | 136 | $this->setArrayBinding($binding); |
137 | 137 | } else { |
138 | 138 | $this->bindings[$key] = ['binding' => $binding, 'calls' => [], 'properties' => []]; |