@@ -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; |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | */ |
| 71 | 71 | public function to($value) |
| 72 | 72 | { |
| 73 | - if(isset($this->bindings[$this->activeKey])) { |
|
| 73 | + if (isset($this->bindings[$this->activeKey])) { |
|
| 74 | 74 | $this->bindings[$this->activeKey]['binding'] = $value; |
| 75 | 75 | } else { |
| 76 | 76 | $this->bindings[$this->activeKey] = ['binding' => $value, 'calls' => [], 'properties' => []]; |
@@ -117,13 +117,13 @@ discard block |
||
| 117 | 117 | */ |
| 118 | 118 | private function setArrayBinding(array $binding) |
| 119 | 119 | { |
| 120 | - if(isset($binding[0])) { |
|
| 120 | + if (isset($binding[0])) { |
|
| 121 | 121 | $this->to($binding[0]); |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | - if(isset($binding['calls'])){ |
|
| 125 | - foreach($binding['calls'] as $call => $parameters) { |
|
| 126 | - if(is_numeric($call)) { |
|
| 124 | + if (isset($binding['calls'])) { |
|
| 125 | + foreach ($binding['calls'] as $call => $parameters) { |
|
| 126 | + if (is_numeric($call)) { |
|
| 127 | 127 | $call = $parameters; |
| 128 | 128 | $parameters = []; |
| 129 | 129 | } |
@@ -133,9 +133,9 @@ discard block |
||
| 133 | 133 | $this->bindings[$this->activeKey]['calls'] = []; |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | - if(isset($binding['sets'])){ |
|
| 137 | - foreach($binding['sets'] as $property => $parameters) { |
|
| 138 | - if(is_numeric($property)) { |
|
| 136 | + if (isset($binding['sets'])) { |
|
| 137 | + foreach ($binding['sets'] as $property => $parameters) { |
|
| 138 | + if (is_numeric($property)) { |
|
| 139 | 139 | $property = $parameters; |
| 140 | 140 | $parameters = []; |
| 141 | 141 | } |
@@ -155,9 +155,9 @@ discard block |
||
| 155 | 155 | */ |
| 156 | 156 | public function merge(array $bindings) |
| 157 | 157 | { |
| 158 | - foreach($bindings as $key => $binding) { |
|
| 158 | + foreach ($bindings as $key => $binding) { |
|
| 159 | 159 | $this->activeKey = $key; |
| 160 | - if(is_array($binding)) { |
|
| 160 | + if (is_array($binding)) { |
|
| 161 | 161 | $this->setArrayBinding($binding); |
| 162 | 162 | } else { |
| 163 | 163 | $this->bindings[$key] = ['binding' => $binding, 'calls' => [], 'properties' => []]; |