@@ -55,9 +55,9 @@ discard block |
||
| 55 | 55 | * @param mixed $value |
| 56 | 56 | * @return self |
| 57 | 57 | */ |
| 58 | - public function to(string|array|callable $value): Bindings |
|
| 58 | + public function to(string | array | callable $value): Bindings |
|
| 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): array |
| 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): void |
| 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): void |
| 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' => []]; |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | return $this; |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | - public function with(string|array|callable $value): Bindings |
|
| 156 | + public function with(string | array | callable $value): Bindings |
|
| 157 | 157 | { |
| 158 | 158 | return $this->to($value); |
| 159 | 159 | } |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | */ |
| 146 | 146 | private function resolveArgument($argument, $class) |
| 147 | 147 | { |
| 148 | - if($class && is_string($argument)) { |
|
| 148 | + if ($class && is_string($argument)) { |
|
| 149 | 149 | return $this->resolve($argument); |
| 150 | 150 | } |
| 151 | 151 | return $argument; |
@@ -200,8 +200,8 @@ discard block |
||
| 200 | 200 | private function injectAttributed(mixed $instance, \ReflectionClass $reflection): void |
| 201 | 201 | { |
| 202 | 202 | // Properties |
| 203 | - foreach($reflection->getProperties() as $property) { |
|
| 204 | - if (count($property->getAttributes(Inject::class)) == 0 ) { |
|
| 203 | + foreach ($reflection->getProperties() as $property) { |
|
| 204 | + if (count($property->getAttributes(Inject::class)) == 0) { |
|
| 205 | 205 | continue; |
| 206 | 206 | } |
| 207 | 207 | $type = $property->getType(); |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | } |
| 218 | 218 | |
| 219 | 219 | // Methods |
| 220 | - foreach($reflection->getMethods() as $method) { |
|
| 220 | + foreach ($reflection->getMethods() as $method) { |
|
| 221 | 221 | if (count($method->getAttributes(Inject::class)) == 0) { |
| 222 | 222 | continue; |
| 223 | 223 | } |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | * @return mixed |
| 234 | 234 | * @throws exceptions\ResolutionException |
| 235 | 235 | */ |
| 236 | - private function getInstance(string|callable $class): mixed |
|
| 236 | + private function getInstance(string | callable $class): mixed |
|
| 237 | 237 | { |
| 238 | 238 | // If the class is a function call it as a factory. |
| 239 | 239 | if (is_callable($class)) { |