@@ -82,7 +82,7 @@ |
||
| 82 | 82 | |
| 83 | 83 | switch ($value['type']) { |
| 84 | 84 | case 'array': |
| 85 | - $arr = (array)$data[$value['attr']]; |
|
| 85 | + $arr = (array)$data[$value['attr']]; |
|
| 86 | 86 | unset($arr['count']); |
| 87 | 87 | $attrs[$attr] = $arr; |
| 88 | 88 | break; |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | */ |
| 110 | 110 | public function removeHeader(string $header): Response |
| 111 | 111 | { |
| 112 | - if(isset($this->headers[$header])) { |
|
| 112 | + if (isset($this->headers[$header])) { |
|
| 113 | 113 | unset($this->headers[$header]); |
| 114 | 114 | } |
| 115 | 115 | |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | $this->terminate(); |
| 213 | 213 | } |
| 214 | 214 | |
| 215 | - if($this->body instanceof Closure) { |
|
| 215 | + if ($this->body instanceof Closure) { |
|
| 216 | 216 | $body = $this->body->call($this); |
| 217 | 217 | } else { |
| 218 | 218 | $body = $this->body; |
@@ -368,14 +368,14 @@ discard block |
||
| 368 | 368 | * @param string $format |
| 369 | 369 | * @return Response |
| 370 | 370 | */ |
| 371 | - public function setOutputFormat(?string $format=null): Response |
|
| 371 | + public function setOutputFormat(?string $format = null) : Response |
|
| 372 | 372 | { |
| 373 | - if($format === null) { |
|
| 373 | + if ($format === null) { |
|
| 374 | 374 | $this->output_format = null; |
| 375 | 375 | return $this->removeHeader('Content-Type'); |
| 376 | 376 | } |
| 377 | 377 | |
| 378 | - if(!array_key_exists($format, self::OUTPUT_FORMATS)) { |
|
| 378 | + if (!array_key_exists($format, self::OUTPUT_FORMATS)) { |
|
| 379 | 379 | throw new Exception('invalid output format given'); |
| 380 | 380 | } |
| 381 | 381 | |
@@ -118,12 +118,12 @@ |
||
| 118 | 118 | * @param ContainerInterface $container |
| 119 | 119 | * @return array |
| 120 | 120 | */ |
| 121 | - public function getCallable(?ContainerInterface $container=null): array |
|
| 121 | + public function getCallable(?ContainerInterface $container = null) : array |
|
| 122 | 122 | { |
| 123 | 123 | if (is_object($this->class)) { |
| 124 | 124 | $instance = $this->class; |
| 125 | 125 | } else { |
| 126 | - if($container === null) { |
|
| 126 | + if ($container === null) { |
|
| 127 | 127 | $instance = new $this->class(); |
| 128 | 128 | } else { |
| 129 | 129 | $instance = $container->get($this->class); |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | { |
| 204 | 204 | if($this->token_validation_url) { |
| 205 | 205 | $this->logger->debug('validate oauth2 token via rfc7662 token validation endpoint ['.$this->token_validation_url.']', [ |
| 206 | - 'category' => get_class($this), |
|
| 206 | + 'category' => get_class($this), |
|
| 207 | 207 | ]); |
| 208 | 208 | |
| 209 | 209 | $url = str_replace('{token}', $token, $this->token_validation_url); |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | } |
| 215 | 215 | |
| 216 | 216 | $this->logger->debug('validate token via openid-connect userinfo_endpoint ['.$discovery['userinfo_endpoint'].']', [ |
| 217 | - 'category' => get_class($this), |
|
| 217 | + 'category' => get_class($this), |
|
| 218 | 218 | ]); |
| 219 | 219 | |
| 220 | 220 | $url = $discovery['userinfo_endpoint'].'?access_token='.$token; |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | if($code === 200) { |
| 232 | 232 | $attributes = json_decode($result, true); |
| 233 | 233 | $this->logger->debug('successfully verified oauth2 access token via authorization server', [ |
| 234 | - 'category' => get_class($this), |
|
| 234 | + 'category' => get_class($this), |
|
| 235 | 235 | ]); |
| 236 | 236 | |
| 237 | 237 | if(!isset($attributes[$this->identity_attribute])) { |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | return true; |
| 250 | 250 | } else { |
| 251 | 251 | $this->logger->error('failed verify oauth2 access token via authorization server, received status ['.$code.']', [ |
| 252 | - 'category' => get_class($this), |
|
| 252 | + 'category' => get_class($this), |
|
| 253 | 253 | ]); |
| 254 | 254 | |
| 255 | 255 | throw new Exception('failed verify oauth2 access token via authorization server'); |
@@ -274,7 +274,7 @@ discard block |
||
| 274 | 274 | } |
| 275 | 275 | |
| 276 | 276 | $this->logger->debug('fetch user attributes from userinfo_endpoint ['.$discovery['userinfo_endpoint'].']', [ |
| 277 | - 'category' => get_class($this), |
|
| 277 | + 'category' => get_class($this), |
|
| 278 | 278 | ]); |
| 279 | 279 | |
| 280 | 280 | $url = $discovery['userinfo_endpoint'].'?access_token='.$this->access_token; |
@@ -289,13 +289,13 @@ discard block |
||
| 289 | 289 | if($code === 200) { |
| 290 | 290 | $attributes = json_decode($result, true); |
| 291 | 291 | $this->logger->debug('successfully requested user attributes from userinfo_endpoint', [ |
| 292 | - 'category' => get_class($this), |
|
| 292 | + 'category' => get_class($this), |
|
| 293 | 293 | ]); |
| 294 | 294 | |
| 295 | 295 | return $this->attributes = $attributes; |
| 296 | 296 | } else { |
| 297 | 297 | $this->logger->error('failed requesting user attributes from userinfo_endpoint, status code ['.$code.']', [ |
| 298 | - 'category' => get_class($this), |
|
| 298 | + 'category' => get_class($this), |
|
| 299 | 299 | ]); |
| 300 | 300 | |
| 301 | 301 | throw new Exception('failed requesting user attribute from userinfo_endpoint'); |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | * @param Iterable $config |
| 70 | 70 | * @return void |
| 71 | 71 | */ |
| 72 | - public function __construct(LoggerInterface $logger, ?Iterable $config=null) |
|
| 72 | + public function __construct(LoggerInterface $logger, ?Iterable $config = null) |
|
| 73 | 73 | { |
| 74 | 74 | $this->logger = $logger; |
| 75 | 75 | $this->setOptions($config); |
@@ -88,8 +88,8 @@ discard block |
||
| 88 | 88 | return $this; |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | - foreach($config as $option => $value) { |
|
| 92 | - switch($option) { |
|
| 91 | + foreach ($config as $option => $value) { |
|
| 92 | + switch ($option) { |
|
| 93 | 93 | case 'provider_url': |
| 94 | 94 | case 'token_validation_url': |
| 95 | 95 | case 'identity_attribute': |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | $code = curl_getinfo($ch, CURLINFO_HTTP_CODE); |
| 171 | 171 | curl_close($ch); |
| 172 | 172 | |
| 173 | - if($code === 200) { |
|
| 173 | + if ($code === 200) { |
|
| 174 | 174 | $discovery = json_decode($result, true); |
| 175 | 175 | $this->logger->debug('received openid-connect discovery document from ['.$url.']', [ |
| 176 | 176 | 'category' => get_class($this), |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | */ |
| 202 | 202 | protected function verifyToken(string $token): bool |
| 203 | 203 | { |
| 204 | - if($this->token_validation_url) { |
|
| 204 | + if ($this->token_validation_url) { |
|
| 205 | 205 | $this->logger->debug('validate oauth2 token via rfc7662 token validation endpoint ['.$this->token_validation_url.']', [ |
| 206 | 206 | 'category' => get_class($this), |
| 207 | 207 | ]); |
@@ -228,19 +228,19 @@ discard block |
||
| 228 | 228 | curl_close($ch); |
| 229 | 229 | $response = json_decode($result, true); |
| 230 | 230 | |
| 231 | - if($code === 200) { |
|
| 231 | + if ($code === 200) { |
|
| 232 | 232 | $attributes = json_decode($result, true); |
| 233 | 233 | $this->logger->debug('successfully verified oauth2 access token via authorization server', [ |
| 234 | 234 | 'category' => get_class($this), |
| 235 | 235 | ]); |
| 236 | 236 | |
| 237 | - if(!isset($attributes[$this->identity_attribute])) { |
|
| 237 | + if (!isset($attributes[$this->identity_attribute])) { |
|
| 238 | 238 | throw new Exception('identity attribute '.$this->identity_attribute.' not found in oauth2 response'); |
| 239 | 239 | } |
| 240 | 240 | |
| 241 | 241 | $this->identifier = $attributes['preferred_username']; |
| 242 | 242 | |
| 243 | - if($this->token_validation_url) { |
|
| 243 | + if ($this->token_validation_url) { |
|
| 244 | 244 | $this->attributes = $attributes; |
| 245 | 245 | } else { |
| 246 | 246 | $this->access_token = $token; |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | */ |
| 265 | 265 | public function getAttributes(): array |
| 266 | 266 | { |
| 267 | - if(count($this->attributes) !== 0) { |
|
| 267 | + if (count($this->attributes) !== 0) { |
|
| 268 | 268 | return $this->attributes; |
| 269 | 269 | } |
| 270 | 270 | |
@@ -286,7 +286,7 @@ discard block |
||
| 286 | 286 | curl_close($ch); |
| 287 | 287 | $response = json_decode($result, true); |
| 288 | 288 | |
| 289 | - if($code === 200) { |
|
| 289 | + if ($code === 200) { |
|
| 290 | 290 | $attributes = json_decode($result, true); |
| 291 | 291 | $this->logger->debug('successfully requested user attributes from userinfo_endpoint', [ |
| 292 | 292 | 'category' => get_class($this), |
@@ -68,12 +68,12 @@ discard block |
||
| 68 | 68 | * @param array $request |
| 69 | 69 | * @return void |
| 70 | 70 | */ |
| 71 | - public function __construct(LoggerInterface $logger, ?array $request=null, ?ContainerInterface $container=null) |
|
| 71 | + public function __construct(LoggerInterface $logger, ? array $request = null, ?ContainerInterface $container = null) |
|
| 72 | 72 | { |
| 73 | 73 | $this->logger = $logger; |
| 74 | 74 | $this->container = $container; |
| 75 | 75 | |
| 76 | - if($request === null) { |
|
| 76 | + if ($request === null) { |
|
| 77 | 77 | $request = $_SERVER; |
| 78 | 78 | } |
| 79 | 79 | |
@@ -286,7 +286,7 @@ discard block |
||
| 286 | 286 | 'code' => $exception->getCode() |
| 287 | 287 | ]; |
| 288 | 288 | |
| 289 | - if(defined("$class::HTTP_CODE")) { |
|
| 289 | + if (defined("$class::HTTP_CODE")) { |
|
| 290 | 290 | $http_code = $class::HTTP_CODE; |
| 291 | 291 | } else { |
| 292 | 292 | $http_code = 500; |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | } else { |
| 66 | 66 | $this->store = $this->variablesToTree($variables); |
| 67 | 67 | } |
| 68 | - } |
|
| 68 | + } |
|
| 69 | 69 | |
| 70 | 70 | |
| 71 | 71 | /** |
@@ -120,12 +120,12 @@ discard block |
||
| 120 | 120 | $key = $name[$i]; |
| 121 | 121 | |
| 122 | 122 | try { |
| 123 | - // create new subtree if requested subtree already has a value |
|
| 124 | - if (!($tree->$key instanceof Config)) { |
|
| 125 | - $tree[$key] = new Config([$tree->$key]); |
|
| 126 | - } |
|
| 123 | + // create new subtree if requested subtree already has a value |
|
| 124 | + if (!($tree->$key instanceof Config)) { |
|
| 125 | + $tree[$key] = new Config([$tree->$key]); |
|
| 126 | + } |
|
| 127 | 127 | |
| 128 | - $tree = $tree->$key; |
|
| 128 | + $tree = $tree->$key; |
|
| 129 | 129 | } catch (Exception $e) { |
| 130 | 130 | // set value if last keypart or create subtree |
| 131 | 131 | if($i == (count($name) - 1)) { |
@@ -55,12 +55,12 @@ discard block |
||
| 55 | 55 | * @param array $variables |
| 56 | 56 | * @return void |
| 57 | 57 | */ |
| 58 | - public function __construct(?string $prefix=null, $delimiter=self::DEFAULT_DELIMITER, array $variables=[]) |
|
| 58 | + public function __construct(?string $prefix = null, $delimiter = self::DEFAULT_DELIMITER, array $variables = []) |
|
| 59 | 59 | { |
| 60 | 60 | $this->delimiter = $delimiter; |
| 61 | 61 | $this->prefix = $prefix ? strtolower($prefix) : ''; |
| 62 | 62 | |
| 63 | - if(count($variables) === 0) { |
|
| 63 | + if (count($variables) === 0) { |
|
| 64 | 64 | $this->store = $this->variablesToTree(array_merge($_ENV, $_SERVER)); |
| 65 | 65 | } else { |
| 66 | 66 | $this->store = $this->variablesToTree($variables); |
@@ -105,8 +105,8 @@ discard block |
||
| 105 | 105 | foreach ($variables as $name => $value) { |
| 106 | 106 | $name = explode($this->delimiter, $name); |
| 107 | 107 | |
| 108 | - if($this->prefix !== null) { |
|
| 109 | - if($name[0] !== $this->prefix) { |
|
| 108 | + if ($this->prefix !== null) { |
|
| 109 | + if ($name[0] !== $this->prefix) { |
|
| 110 | 110 | continue; |
| 111 | 111 | } else { |
| 112 | 112 | array_shift($name); |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | $tree = $tree->$key; |
| 128 | 128 | } catch (Exception $e) { |
| 129 | 129 | // set value if last keypart or create subtree |
| 130 | - if($i == (count($name) - 1)) { |
|
| 130 | + if ($i == (count($name) - 1)) { |
|
| 131 | 131 | $tree[$key] = $value; |
| 132 | 132 | } else { |
| 133 | 133 | $tree[$key] = new Config(); |
@@ -42,9 +42,9 @@ discard block |
||
| 42 | 42 | * @param string $config |
| 43 | 43 | * @return void |
| 44 | 44 | */ |
| 45 | - public function __construct(?ConfigInterface $config=null) |
|
| 45 | + public function __construct(?ConfigInterface $config = null) |
|
| 46 | 46 | { |
| 47 | - if($config !== null) { |
|
| 47 | + if ($config !== null) { |
|
| 48 | 48 | $this->_store = $config->map()->children(); |
| 49 | 49 | } |
| 50 | 50 | } |
@@ -69,8 +69,8 @@ discard block |
||
| 69 | 69 | */ |
| 70 | 70 | public function merge(Config $from): Config |
| 71 | 71 | { |
| 72 | - foreach($from as $key => $value) { |
|
| 73 | - if(isset($this->_store[$key]) && $this->_store[$key] instanceof Config) { |
|
| 72 | + foreach ($from as $key => $value) { |
|
| 73 | + if (isset($this->_store[$key]) && $this->_store[$key] instanceof Config) { |
|
| 74 | 74 | $this->_store[$key]->merge($value); |
| 75 | 75 | } else { |
| 76 | 76 | $this->_store[$key] = $value; |
@@ -87,7 +87,7 @@ |
||
| 87 | 87 | * @param Logger $logger |
| 88 | 88 | * @return resource |
| 89 | 89 | */ |
| 90 | - public function __construct(LoggerInterface $logger, ?Iterable $config=null) |
|
| 90 | + public function __construct(LoggerInterface $logger, ?Iterable $config = null) |
|
| 91 | 91 | { |
| 92 | 92 | $this->setOptions($config); |
| 93 | 93 | $this->logger = $logger; |
@@ -191,7 +191,7 @@ |
||
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | $args[$param_name] = $this->findParentService($name, $type_class, $config, $parents); |
| 194 | - } |
|
| 194 | + } |
|
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | return $this->createInstance($name, $reflection, $args, $config, $parents); |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | * |
| 49 | 49 | * @param array $config |
| 50 | 50 | */ |
| 51 | - public function __construct(Iterable $config=[]) |
|
| 51 | + public function __construct(Iterable $config = []) |
|
| 52 | 52 | { |
| 53 | 53 | $this->config = $config; |
| 54 | 54 | $container = $this; |
@@ -66,10 +66,10 @@ discard block |
||
| 66 | 66 | */ |
| 67 | 67 | public function get($name) |
| 68 | 68 | { |
| 69 | - if($this->has($name)) { |
|
| 69 | + if ($this->has($name)) { |
|
| 70 | 70 | return $this->service[$name]['instance']; |
| 71 | 71 | } else { |
| 72 | - if(isset($this->registry[$name])) { |
|
| 72 | + if (isset($this->registry[$name])) { |
|
| 73 | 73 | $this->service[$name]['instance'] = $this->registry[$name]->call($this); |
| 74 | 74 | unset($this->registry[$name]); |
| 75 | 75 | return $this->service[$name]['instance']; |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | */ |
| 89 | 89 | public function getNew(string $name) |
| 90 | 90 | { |
| 91 | - if(isset($this->registry[$name])) { |
|
| 91 | + if (isset($this->registry[$name])) { |
|
| 92 | 92 | return $this->registry[$name]->call($this); |
| 93 | 93 | } else { |
| 94 | 94 | return $this->autoWire($name); |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | */ |
| 106 | 106 | public function add(string $name, Closure $service): Container |
| 107 | 107 | { |
| 108 | - if($this->has($name)) { |
|
| 108 | + if ($this->has($name)) { |
|
| 109 | 109 | throw new Exception('service '.$name.' is already registered'); |
| 110 | 110 | } |
| 111 | 111 | |
@@ -133,18 +133,18 @@ discard block |
||
| 133 | 133 | * @param array $parents |
| 134 | 134 | * @return mixed |
| 135 | 135 | */ |
| 136 | - protected function autoWire(string $name, $config=null, array $parents=[]) |
|
| 136 | + protected function autoWire(string $name, $config = null, array $parents = []) |
|
| 137 | 137 | { |
| 138 | - if($config === null) { |
|
| 138 | + if ($config === null) { |
|
| 139 | 139 | $config = $this->config; |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | $class = $name; |
| 143 | 143 | $sub_config = $config; |
| 144 | - if(isset($config[$name])) { |
|
| 145 | - if(isset($config[$name]['use'])) { |
|
| 144 | + if (isset($config[$name])) { |
|
| 145 | + if (isset($config[$name]['use'])) { |
|
| 146 | 146 | $class = $config[$name]['use']; |
| 147 | - } elseif(isset($config[$name]['name'])) { |
|
| 147 | + } elseif (isset($config[$name]['name'])) { |
|
| 148 | 148 | $class = $config[$name]['name']; |
| 149 | 149 | } |
| 150 | 150 | |
@@ -155,29 +155,29 @@ discard block |
||
| 155 | 155 | |
| 156 | 156 | try { |
| 157 | 157 | $reflection = new ReflectionClass($class); |
| 158 | - } catch(\Exception $e) { |
|
| 158 | + } catch (\Exception $e) { |
|
| 159 | 159 | throw new Exception($class.' can not be resolved to an existing class'); |
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | $constructor = $reflection->getConstructor(); |
| 163 | 163 | |
| 164 | - if($constructor === null) { |
|
| 164 | + if ($constructor === null) { |
|
| 165 | 165 | return new $class(); |
| 166 | 166 | } else { |
| 167 | 167 | $params = $constructor->getParameters(); |
| 168 | 168 | $args = []; |
| 169 | 169 | |
| 170 | - foreach($params as $param) { |
|
| 170 | + foreach ($params as $param) { |
|
| 171 | 171 | $type = $param->getClass(); |
| 172 | 172 | $param_name = $param->getName(); |
| 173 | 173 | |
| 174 | - if($type === null) { |
|
| 174 | + if ($type === null) { |
|
| 175 | 175 | try { |
| 176 | 176 | $args[$param_name] = $this->getParam($name, $param_name, $sub_config); |
| 177 | - } catch(Exception $e) { |
|
| 178 | - if($param->isDefaultValueAvailable()) { |
|
| 177 | + } catch (Exception $e) { |
|
| 178 | + if ($param->isDefaultValueAvailable()) { |
|
| 179 | 179 | $args[$param_name] = $param->getDefaultValue(); |
| 180 | - } elseif($param->allowsNull()) { |
|
| 180 | + } elseif ($param->allowsNull()) { |
|
| 181 | 181 | $args[$param_name] = null; |
| 182 | 182 | } else { |
| 183 | 183 | throw $e; |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | } else { |
| 187 | 187 | $type_class = $type->getName(); |
| 188 | 188 | |
| 189 | - if($type_class === $name) { |
|
| 189 | + if ($type_class === $name) { |
|
| 190 | 190 | throw new Exception('class '.$type_class.' can not depend on itself'); |
| 191 | 191 | } |
| 192 | 192 | |
@@ -210,10 +210,10 @@ discard block |
||
| 210 | 210 | { |
| 211 | 211 | $service = null; |
| 212 | 212 | $services = $this->service; |
| 213 | - foreach(array_reverse($parents) as $name => $parent) { |
|
| 214 | - if(isset($services[$name])) { |
|
| 213 | + foreach (array_reverse($parents) as $name => $parent) { |
|
| 214 | + if (isset($services[$name])) { |
|
| 215 | 215 | $service = $services[$name]; |
| 216 | - if(isset($services['service'])) { |
|
| 216 | + if (isset($services['service'])) { |
|
| 217 | 217 | $services = $services['service']; } |
| 218 | 218 | else { |
| 219 | 219 | break; |
@@ -223,12 +223,12 @@ discard block |
||
| 223 | 223 | } |
| 224 | 224 | } |
| 225 | 225 | |
| 226 | - if($service !== null) { |
|
| 226 | + if ($service !== null) { |
|
| 227 | 227 | return $service['instance']; |
| 228 | 228 | } |
| 229 | 229 | |
| 230 | - foreach(array_reverse($parents) as $parent) { |
|
| 231 | - if(isset($parent['service'][$class])) { |
|
| 230 | + foreach (array_reverse($parents) as $parent) { |
|
| 231 | + if (isset($parent['service'][$class])) { |
|
| 232 | 232 | return $this->autoWire($class, $parent['service'], $parents); |
| 233 | 233 | } |
| 234 | 234 | } |
@@ -245,17 +245,17 @@ discard block |
||
| 245 | 245 | * @param array $args |
| 246 | 246 | * @return mixed |
| 247 | 247 | */ |
| 248 | - protected function createInstance(string $name, ReflectionClass $class, array $args, Iterable $config, $parents=[]) |
|
| 248 | + protected function createInstance(string $name, ReflectionClass $class, array $args, Iterable $config, $parents = []) |
|
| 249 | 249 | { |
| 250 | 250 | $instance = $class->newInstanceArgs($args); |
| 251 | 251 | |
| 252 | 252 | $loop = &$this->service; |
| 253 | - foreach($parents as $p => $parent) { |
|
| 253 | + foreach ($parents as $p => $parent) { |
|
| 254 | 254 | $loop = &$loop[$p]; |
| 255 | 255 | } |
| 256 | - if(count($parents) === 0) { |
|
| 256 | + if (count($parents) === 0) { |
|
| 257 | 257 | $loop[$name]['instance'] = $instance; |
| 258 | - } else { |
|
| 258 | + } else { |
|
| 259 | 259 | $loop['service'][$name]['instance'] = $instance; |
| 260 | 260 | } |
| 261 | 261 | |
@@ -265,15 +265,15 @@ discard block |
||
| 265 | 265 | |
| 266 | 266 | array_unshift($parents, $name); |
| 267 | 267 | |
| 268 | - if($instance instanceof AdapterAwareInterface) { |
|
| 269 | - if(isset($config['adapter'])) { |
|
| 268 | + if ($instance instanceof AdapterAwareInterface) { |
|
| 269 | + if (isset($config['adapter'])) { |
|
| 270 | 270 | $adapters = $config['adapter']; |
| 271 | 271 | } else { |
| 272 | 272 | $adapters = $instance->getDefaultAdapter(); |
| 273 | 273 | } |
| 274 | 274 | |
| 275 | - foreach($adapters as $adapter => $service) { |
|
| 276 | - if(isset($service['enabled']) && $service['enabled'] === '0') { |
|
| 275 | + foreach ($adapters as $adapter => $service) { |
|
| 276 | + if (isset($service['enabled']) && $service['enabled'] === '0') { |
|
| 277 | 277 | continue; |
| 278 | 278 | } |
| 279 | 279 | |
@@ -282,7 +282,7 @@ discard block |
||
| 282 | 282 | $class = $adapter; |
| 283 | 283 | $adapter_instance = $this->autoWire($class, $adapters, $parents); |
| 284 | 284 | |
| 285 | - if(isset($service['expose']) && $service['expose']) { |
|
| 285 | + if (isset($service['expose']) && $service['expose']) { |
|
| 286 | 286 | $this->service[$adapter]['instance'] = $adapter_instance; |
| 287 | 287 | } |
| 288 | 288 | |
@@ -301,13 +301,13 @@ discard block |
||
| 301 | 301 | * @param string $param |
| 302 | 302 | * @return mixed |
| 303 | 303 | */ |
| 304 | - public function getParam(string $name, string $param, ?Iterable $config=null) |
|
| 304 | + public function getParam(string $name, string $param, ?Iterable $config = null) |
|
| 305 | 305 | { |
| 306 | - if($config === null) { |
|
| 306 | + if ($config === null) { |
|
| 307 | 307 | $config = $this->config; |
| 308 | 308 | } |
| 309 | 309 | |
| 310 | - if(!isset($config[$name]['options'][$param])) { |
|
| 310 | + if (!isset($config[$name]['options'][$param])) { |
|
| 311 | 311 | throw new Exception('no configuration available for required service parameter '.$param); |
| 312 | 312 | } |
| 313 | 313 | |