@@ -44,12 +44,13 @@ discard block |
||
| 44 | 44 | $construction_args []= $this->get($param->getType().''); |
| 45 | 45 | } |
| 46 | 46 | $instance = $rc->newInstanceArgs($construction_args); |
| 47 | + } else { |
|
| 48 | + $instance = $rc->newInstanceArgs(); |
|
| 47 | 49 | } |
| 48 | - else |
|
| 49 | - $instance = $rc->newInstanceArgs(); |
|
| 50 | 50 | |
| 51 | - if($rc->hasMethod('set_container')) |
|
| 52 | - $instance->set_container($this); |
|
| 51 | + if($rc->hasMethod('set_container')) { |
|
| 52 | + $instance->set_container($this); |
|
| 53 | + } |
|
| 53 | 54 | |
| 54 | 55 | return $instance; |
| 55 | 56 | } |
@@ -62,8 +63,9 @@ discard block |
||
| 62 | 63 | //dot based hierarchy, parse and climb |
| 63 | 64 | foreach(explode('.', $setting) as $k) |
| 64 | 65 | { |
| 65 | - if(!isset($ret[$k])) |
|
| 66 | - throw new ConfigurationException($setting); |
|
| 66 | + if(!isset($ret[$k])) { |
|
| 67 | + throw new ConfigurationException($setting); |
|
| 68 | + } |
|
| 67 | 69 | $ret = $ret[$k]; |
| 68 | 70 | } |
| 69 | 71 | |
@@ -73,11 +75,13 @@ discard block |
||
| 73 | 75 | public function get($configuration) |
| 74 | 76 | { |
| 75 | 77 | |
| 76 | - if(!is_string($configuration)) |
|
| 77 | - throw new LamentException($configuration); |
|
| 78 | + if(!is_string($configuration)) { |
|
| 79 | + throw new LamentException($configuration); |
|
| 80 | + } |
|
| 78 | 81 | |
| 79 | - if($this->has($configuration)) |
|
| 80 | - return $this->configurations[$configuration]; |
|
| 82 | + if($this->has($configuration)) { |
|
| 83 | + return $this->configurations[$configuration]; |
|
| 84 | + } |
|
| 81 | 85 | |
| 82 | 86 | // fallbacks |
| 83 | 87 | // 1. configuration data |
@@ -86,11 +90,12 @@ discard block |
||
| 86 | 90 | if(preg_match('/^settings\./', $configuration, $m) === 1) |
| 87 | 91 | { |
| 88 | 92 | return $this->get_settings($configuration); |
| 89 | - } |
|
| 90 | - elseif(class_exists($configuration)) // auto create instances |
|
| 93 | + } elseif(class_exists($configuration)) { |
|
| 94 | + // auto create instances |
|
| 91 | 95 | { |
| 92 | 96 | return $this->get_instance($configuration); |
| 93 | 97 | } |
| 98 | + } |
|
| 94 | 99 | |
| 95 | 100 | throw new ConfigurationException($configuration); |
| 96 | 101 | } |