@@ -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 = 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); |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | $tree = $tree->$key; |
| 129 | 129 | } catch (Exception $e) { |
| 130 | 130 | // set value if last keypart or create subtree |
| 131 | - if($i == (count($name) - 1)) { |
|
| 131 | + if ($i == (count($name) - 1)) { |
|
| 132 | 132 | $tree[$key] = $value; |
| 133 | 133 | } else { |
| 134 | 134 | $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->config = $config->map(); |
| 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; |