@@ -39,8 +39,7 @@ discard block |
||
| 39 | 39 | public function newConfig(array $aOptions = [], |
| 40 | 40 | string $sNamePrefix = '', string $sValuePrefix = ''): Config |
| 41 | 41 | { |
| 42 | - return count($aOptions) === 0 ? new Config() : |
|
| 43 | - $this->setOptions(new Config(), $aOptions, $sNamePrefix, $sValuePrefix); |
|
| 42 | + return count($aOptions) === 0 ? new Config() : $this->setOptions(new Config(), $aOptions, $sNamePrefix, $sValuePrefix); |
|
| 44 | 43 | } |
| 45 | 44 | |
| 46 | 45 | /** |
@@ -72,7 +71,7 @@ discard block |
||
| 72 | 71 | $xValue = $xOptionValue; |
| 73 | 72 | $sLastName = ''; |
| 74 | 73 | $aNames = Value::explodeName($sOptionName); |
| 75 | - while($this->pop($sLastName, $aNames) > 0) |
|
| 74 | + while ($this->pop($sLastName, $aNames) > 0) |
|
| 76 | 75 | { |
| 77 | 76 | $sName = implode('.', $aNames); |
| 78 | 77 | // The current value is overwritten if it is not an array of options. |
@@ -116,15 +115,15 @@ discard block |
||
| 116 | 115 | string $sNamePrefix = '', int $nDepth = 0): array |
| 117 | 116 | { |
| 118 | 117 | // Check the max depth |
| 119 | - if($nDepth < 0 || $nDepth > 9) |
|
| 118 | + if ($nDepth < 0 || $nDepth > 9) |
|
| 120 | 119 | { |
| 121 | 120 | throw new DataDepth($sNamePrefix, $nDepth); |
| 122 | 121 | } |
| 123 | 122 | |
| 124 | - foreach($aOptions as $sName => $xValue) |
|
| 123 | + foreach ($aOptions as $sName => $xValue) |
|
| 125 | 124 | { |
| 126 | 125 | $sName = trim($sName); |
| 127 | - if(!Value::containsOptions($xValue)) |
|
| 126 | + if (!Value::containsOptions($xValue)) |
|
| 128 | 127 | { |
| 129 | 128 | // Save the value of this option |
| 130 | 129 | $aValues = $this->setValue($aValues, $sNamePrefix . $sName, $xValue); |
@@ -155,11 +154,11 @@ discard block |
||
| 155 | 154 | // Find the config array in the input data |
| 156 | 155 | $sValuePrefix = trim($sValuePrefix, ' .'); |
| 157 | 156 | $aKeys = Value::explodeName($sValuePrefix); |
| 158 | - foreach($aKeys as $sKey) |
|
| 157 | + foreach ($aKeys as $sKey) |
|
| 159 | 158 | { |
| 160 | - if(($sKey)) |
|
| 159 | + if (($sKey)) |
|
| 161 | 160 | { |
| 162 | - if(!isset($aOptions[$sKey]) || !is_array($aOptions[$sKey])) |
|
| 161 | + if (!isset($aOptions[$sKey]) || !is_array($aOptions[$sKey])) |
|
| 163 | 162 | { |
| 164 | 163 | // No change if the required key is not found. |
| 165 | 164 | return new Config($xConfig->getValues(), false); |
@@ -170,7 +169,7 @@ discard block |
||
| 170 | 169 | } |
| 171 | 170 | |
| 172 | 171 | $sNamePrefix = trim($sNamePrefix, ' .'); |
| 173 | - if(($sNamePrefix)) |
|
| 172 | + if (($sNamePrefix)) |
|
| 174 | 173 | { |
| 175 | 174 | $sNamePrefix .= '.'; |
| 176 | 175 | } |
@@ -89,11 +89,11 @@ |
||
| 89 | 89 | $sKey = trim($sKey, ' .'); |
| 90 | 90 | $aKeys = Value::explodeName($sKey); |
| 91 | 91 | $aValues = $this->aValues; |
| 92 | - foreach($aKeys as $_sKey) |
|
| 92 | + foreach ($aKeys as $_sKey) |
|
| 93 | 93 | { |
| 94 | 94 | $aValues = $aValues[$_sKey] ?? []; |
| 95 | 95 | } |
| 96 | - if(!Value::containsOptions($aValues)) |
|
| 96 | + if (!Value::containsOptions($aValues)) |
|
| 97 | 97 | { |
| 98 | 98 | return []; |
| 99 | 99 | } |