Passed
Push — main ( 917f8e...d2a078 )
by Thierry
02:06
created
src/ConfigSetter.php 1 patch
Spacing   +11 added lines, -12 removed lines patch added patch discarded remove patch
@@ -44,8 +44,7 @@  discard block
 block discarded – undo
44 44
     public function newConfig(array $aOptions = [],
45 45
         string $sNamePrefix = '', string $sValuePrefix = ''): Config
46 46
     {
47
-        return count($aOptions) === 0 ? new Config() :
48
-            $this->setOptions(new Config(), $aOptions, $sNamePrefix, $sValuePrefix);
47
+        return count($aOptions) === 0 ? new Config() : $this->setOptions(new Config(), $aOptions, $sNamePrefix, $sValuePrefix);
49 48
     }
50 49
 
51 50
     /**
@@ -77,7 +76,7 @@  discard block
 block discarded – undo
77 76
         $xValue = $xOptionValue;
78 77
         $sLastName = '';
79 78
         $aNames = Value::explodeName($sOptionName);
80
-        while($this->pop($sLastName, $aNames) > 0)
79
+        while ($this->pop($sLastName, $aNames) > 0)
81 80
         {
82 81
             $sName = implode('.', $aNames);
83 82
             // The current value is overwritten if it is not an array of options.
@@ -121,15 +120,15 @@  discard block
 block discarded – undo
121 120
         string $sNamePrefix = '', int $nDepth = 0): array
122 121
     {
123 122
         // Check the max depth
124
-        if($nDepth < 0 || $nDepth > 9)
123
+        if ($nDepth < 0 || $nDepth > 9)
125 124
         {
126 125
             throw new DataDepth($sNamePrefix, $nDepth);
127 126
         }
128 127
 
129
-        foreach($aOptions as $sName => $xValue)
128
+        foreach ($aOptions as $sName => $xValue)
130 129
         {
131 130
             $sName = trim($sName);
132
-            if(!Value::containsOptions($xValue))
131
+            if (!Value::containsOptions($xValue))
133 132
             {
134 133
                 // Save the value of this option
135 134
                 $aValues = $this->setValue($aValues, $sNamePrefix . $sName, $xValue);
@@ -160,11 +159,11 @@  discard block
 block discarded – undo
160 159
         // Find the config array in the input data
161 160
         $sValuePrefix = trim($sValuePrefix, ' .');
162 161
         $aKeys = Value::explodeName($sValuePrefix);
163
-        foreach($aKeys as $sKey)
162
+        foreach ($aKeys as $sKey)
164 163
         {
165
-            if(($sKey))
164
+            if (($sKey))
166 165
             {
167
-                if(!isset($aOptions[$sKey]) || !is_array($aOptions[$sKey]))
166
+                if (!isset($aOptions[$sKey]) || !is_array($aOptions[$sKey]))
168 167
                 {
169 168
                     // No change if the required key is not found.
170 169
                     return new Config($xConfig->getValues(), false);
@@ -175,7 +174,7 @@  discard block
 block discarded – undo
175 174
         }
176 175
 
177 176
         $sNamePrefix = trim($sNamePrefix, ' .');
178
-        if(($sNamePrefix))
177
+        if (($sNamePrefix))
179 178
         {
180 179
             $sNamePrefix .= '.';
181 180
         }
@@ -204,7 +203,7 @@  discard block
 block discarded – undo
204 203
     private function deleteEntries(array $aValues, string $sName): array
205 204
     {
206 205
         $sName = rtrim($sName, '.');
207
-        if(!array_key_exists($sName, $aValues))
206
+        if (!array_key_exists($sName, $aValues))
208 207
         {
209 208
             return $aValues;
210 209
         }
@@ -229,7 +228,7 @@  discard block
 block discarded – undo
229 228
     {
230 229
         $aValues = $xConfig->getValues();
231 230
         $nEntryCount = count($aValues);
232
-        foreach($aNames as $sName)
231
+        foreach ($aNames as $sName)
233 232
         {
234 233
             $aValues = $this->deleteEntries($aValues, $sName);
235 234
         }
Please login to merge, or discard this patch.