@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | public function __debugInfo() : array |
| 17 | 17 | { |
| 18 | 18 | $dbg = get_object_vars($this); |
| 19 | - $dbg['configurations']['template_engine'] = isset($dbg['configurations']['template_engine'])? get_class($dbg['configurations']['template_engine']) : 'NOT SET'; |
|
| 19 | + $dbg['configurations']['template_engine'] = isset($dbg['configurations']['template_engine']) ? get_class($dbg['configurations']['template_engine']) : 'NOT SET'; |
|
| 20 | 20 | |
| 21 | 21 | return $dbg; |
| 22 | 22 | } |
@@ -34,45 +34,45 @@ discard block |
||
| 34 | 34 | public function get($configuration) |
| 35 | 35 | { |
| 36 | 36 | |
| 37 | - if(!is_string($configuration)) |
|
| 37 | + if (!is_string($configuration)) |
|
| 38 | 38 | throw new LamentException($configuration); |
| 39 | 39 | |
| 40 | - if($this->has($configuration)) |
|
| 40 | + if ($this->has($configuration)) |
|
| 41 | 41 | return $this->configurations[$configuration]; |
| 42 | 42 | |
| 43 | 43 | |
| 44 | 44 | // fallbacks |
| 45 | - if(preg_match('/^settings\./', $configuration, $m) === 1) |
|
| 45 | + if (preg_match('/^settings\./', $configuration, $m) === 1) |
|
| 46 | 46 | { |
| 47 | 47 | $ret = $this->configurations; |
| 48 | - foreach(explode('.', $configuration) as $k) |
|
| 48 | + foreach (explode('.', $configuration) as $k) |
|
| 49 | 49 | { |
| 50 | - if(!isset($ret[$k])) |
|
| 50 | + if (!isset($ret[$k])) |
|
| 51 | 51 | throw new ConfigurationException($configuration); |
| 52 | 52 | $ret = $ret[$k]; |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | return $ret; |
| 56 | 56 | } |
| 57 | - elseif(class_exists($configuration)) // auto create instances |
|
| 57 | + elseif (class_exists($configuration)) // auto create instances |
|
| 58 | 58 | { |
| 59 | 59 | |
| 60 | 60 | $rc = new \ReflectionClass($configuration); |
| 61 | 61 | |
| 62 | 62 | $construction_args = []; |
| 63 | 63 | $instance = null; |
| 64 | - if(!is_null($rc->getConstructor())) |
|
| 64 | + if (!is_null($rc->getConstructor())) |
|
| 65 | 65 | { |
| 66 | - foreach($rc->getConstructor()->getParameters() as $param) |
|
| 66 | + foreach ($rc->getConstructor()->getParameters() as $param) |
|
| 67 | 67 | { |
| 68 | - $construction_args []= $this->get($param->getType().''); |
|
| 68 | + $construction_args [] = $this->get($param->getType().''); |
|
| 69 | 69 | } |
| 70 | 70 | $instance = $rc->newInstanceArgs($construction_args); |
| 71 | 71 | } |
| 72 | 72 | else |
| 73 | 73 | $instance = $rc->newInstanceArgs(); |
| 74 | 74 | |
| 75 | - if($rc->hasMethod('set_container')) |
|
| 75 | + if ($rc->hasMethod('set_container')) |
|
| 76 | 76 | $instance->set_container($this); |
| 77 | 77 | |
| 78 | 78 | return $instance; |