@@ -48,11 +48,11 @@ discard block  | 
                                                    ||
| 48 | 48 | public function setSource(&$source): void  | 
                                                        
| 49 | 49 |      { | 
                                                        
| 50 | 50 | /** @var array<scalar, mixed>|object|mixed|null $source */  | 
                                                        
| 51 | -        if($source === null) { | 
                                                        |
| 51 | +        if ($source === null) { | 
                                                        |
| 52 | 52 | $source = [];  | 
                                                        
| 53 | 53 | }  | 
                                                        
| 54 | 54 | |
| 55 | -        if(is_scalar($source)) { | 
                                                        |
| 55 | +        if (is_scalar($source)) { | 
                                                        |
| 56 | 56 | throw NestedAccessorException::createAsSourceIsScalar($source);  | 
                                                        
| 57 | 57 | }  | 
                                                        
| 58 | 58 | |
@@ -66,7 +66,7 @@ discard block  | 
                                                    ||
| 66 | 66 | public function get($path = null, bool $strict = true)  | 
                                                        
| 67 | 67 |      { | 
                                                        
| 68 | 68 | // when path is not specified  | 
                                                        
| 69 | -        if($path === null || $path === '') { | 
                                                        |
| 69 | +        if ($path === null || $path === '') { | 
                                                        |
| 70 | 70 | // let's return the full source  | 
                                                        
| 71 | 71 | return $this->source;  | 
                                                        
| 72 | 72 | }  | 
                                                        
@@ -86,7 +86,7 @@ discard block  | 
                                                    ||
| 86 | 86 | );  | 
                                                        
| 87 | 87 | |
| 88 | 88 | // when strict mode is on and we got errors  | 
                                                        
| 89 | -        if($strict && $errorsCount) { | 
                                                        |
| 89 | +        if ($strict && $errorsCount) { | 
                                                        |
| 90 | 90 | throw NestedAccessorException::createAsCannotGetValue(  | 
                                                        
| 91 | 91 | implode($this->pathDelimiter, $path),  | 
                                                        
| 92 | 92 | $errorsCount  | 
                                                        
@@ -121,8 +121,8 @@ discard block  | 
                                                    ||
| 121 | 121 |      { | 
                                                        
| 122 | 122 | $path = $this->formatPath($path);  | 
                                                        
| 123 | 123 | |
| 124 | -        if(!$this->exist($path)) { | 
                                                        |
| 125 | -            if($strict) { | 
                                                        |
| 124 | +        if (!$this->exist($path)) { | 
                                                        |
| 125 | +            if ($strict) { | 
                                                        |
| 126 | 126 | throw NestedAccessorException::createAsCannotSetValue(  | 
                                                        
| 127 | 127 | self::SET_MODE_DELETE,  | 
                                                        
| 128 | 128 | implode($this->pathDelimiter, $path)  | 
                                                        
@@ -142,7 +142,7 @@ discard block  | 
                                                    ||
| 142 | 142 |          try { | 
                                                        
| 143 | 143 | $this->get($path);  | 
                                                        
| 144 | 144 | return true;  | 
                                                        
| 145 | -        } catch(NestedAccessorException $e) { | 
                                                        |
| 145 | +        } catch (NestedAccessorException $e) { | 
                                                        |
| 146 | 146 | return false;  | 
                                                        
| 147 | 147 | }  | 
                                                        
| 148 | 148 | }  | 
                                                        
@@ -154,7 +154,7 @@ discard block  | 
                                                    ||
| 154 | 154 |      { | 
                                                        
| 155 | 155 |          try { | 
                                                        
| 156 | 156 | return $this->get($path) !== null;  | 
                                                        
| 157 | -        } catch(NestedAccessorException $e) { | 
                                                        |
| 157 | +        } catch (NestedAccessorException $e) { | 
                                                        |
| 158 | 158 | return false;  | 
                                                        
| 159 | 159 | }  | 
                                                        
| 160 | 160 | }  | 
                                                        
@@ -170,14 +170,14 @@ discard block  | 
                                                    ||
| 170 | 170 | protected function _get($source, array $path, &$result, int &$errorsCount): void  | 
                                                        
| 171 | 171 |      { | 
                                                        
| 172 | 172 | // let's iterate every path part from stack  | 
                                                        
| 173 | -        while(count($path)) { | 
                                                        |
| 174 | -            if(is_array($source) && !ArrayHelper::isAssoc($source)) { | 
                                                        |
| 173 | +        while (count($path)) { | 
                                                        |
| 174 | +            if (is_array($source) && !ArrayHelper::isAssoc($source)) { | 
                                                        |
| 175 | 175 | // the result will be multiple  | 
                                                        
| 176 | -                if(!is_array($result)) { | 
                                                        |
| 176 | +                if (!is_array($result)) { | 
                                                        |
| 177 | 177 | $result = [];  | 
                                                        
| 178 | 178 | }  | 
                                                        
| 179 | 179 | // and we need to use recursive call for each item of this array  | 
                                                        
| 180 | -                foreach($source as $item) { | 
                                                        |
| 180 | +                foreach ($source as $item) { | 
                                                        |
| 181 | 181 | $this->_get($item, $path, $result, $errorsCount);  | 
                                                        
| 182 | 182 | }  | 
                                                        
| 183 | 183 | // we don't need to do something in this recursive branch  | 
                                                        
@@ -186,8 +186,8 @@ discard block  | 
                                                    ||
| 186 | 186 | |
| 187 | 187 | $key = array_pop($path);  | 
                                                        
| 188 | 188 | |
| 189 | -            if(is_array($source)) { | 
                                                        |
| 190 | -                if(!array_key_exists($key, $source)) { | 
                                                        |
| 189 | +            if (is_array($source)) { | 
                                                        |
| 190 | +                if (!array_key_exists($key, $source)) { | 
                                                        |
| 191 | 191 | // path part key is missing in source array  | 
                                                        
| 192 | 192 | $errorsCount++;  | 
                                                        
| 193 | 193 | // we cannot go deeper  | 
                                                        
@@ -195,11 +195,11 @@ discard block  | 
                                                    ||
| 195 | 195 | }  | 
                                                        
| 196 | 196 | // go to the next nested level  | 
                                                        
| 197 | 197 | $source = $source[$key];  | 
                                                        
| 198 | -            } elseif(is_object($source)) { | 
                                                        |
| 199 | -                if(ObjectHelper::hasPropertyAccessibleByGetter($source, $key)) { | 
                                                        |
| 198 | +            } elseif (is_object($source)) { | 
                                                        |
| 199 | +                if (ObjectHelper::hasPropertyAccessibleByGetter($source, $key)) { | 
                                                        |
| 200 | 200 | // go to the next nested level  | 
                                                        
| 201 | 201 | $source = ObjectHelper::getPropertyByGetter($source, $key);  | 
                                                        
| 202 | -                } elseif(ObjectHelper::hasPublicProperty($source, $key)) { | 
                                                        |
| 202 | +                } elseif (ObjectHelper::hasPublicProperty($source, $key)) { | 
                                                        |
| 203 | 203 | // go to the next nested level  | 
                                                        
| 204 | 204 |                      $source = $source->{$key}; | 
                                                        
| 205 | 205 |                  } else { | 
                                                        
@@ -217,13 +217,13 @@ discard block  | 
                                                    ||
| 217 | 217 | |
| 218 | 218 | // when it's not the last iteration of the stack  | 
                                                        
| 219 | 219 | // and the source is non-associative array (list)  | 
                                                        
| 220 | -            if(count($path) && is_array($source) && !ArrayHelper::isAssoc($source)) { | 
                                                        |
| 220 | +            if (count($path) && is_array($source) && !ArrayHelper::isAssoc($source)) { | 
                                                        |
| 221 | 221 | // the result will be multiple  | 
                                                        
| 222 | -                if(!is_array($result)) { | 
                                                        |
| 222 | +                if (!is_array($result)) { | 
                                                        |
| 223 | 223 | $result = [];  | 
                                                        
| 224 | 224 | }  | 
                                                        
| 225 | 225 | // and we need to use recursive call for each item of this array  | 
                                                        
| 226 | -                foreach($source as $item) { | 
                                                        |
| 226 | +                foreach ($source as $item) { | 
                                                        |
| 227 | 227 | $this->_get($item, $path, $result, $errorsCount);  | 
                                                        
| 228 | 228 | }  | 
                                                        
| 229 | 229 | // we don't need to do something in this recursive branch  | 
                                                        
@@ -233,7 +233,7 @@ discard block  | 
                                                    ||
| 233 | 233 | |
| 234 | 234 | // now path stack is empty — we reached target value of given path in source argument  | 
                                                        
| 235 | 235 | // so if result is multiple  | 
                                                        
| 236 | -        if(is_array($result)) { | 
                                                        |
| 236 | +        if (is_array($result)) { | 
                                                        |
| 237 | 237 | // we append source to result  | 
                                                        
| 238 | 238 | $result[] = $source;  | 
                                                        
| 239 | 239 |          } else { | 
                                                        
@@ -260,8 +260,8 @@ discard block  | 
                                                    ||
| 260 | 260 | $tempPrevKey = null;  | 
                                                        
| 261 | 261 | |
| 262 | 262 | // let's iterate every path part to go deeper into nesting  | 
                                                        
| 263 | -        foreach($path as $key) { | 
                                                        |
| 264 | -            if(isset($temp) && is_scalar($temp)) { | 
                                                        |
| 263 | +        foreach ($path as $key) { | 
                                                        |
| 264 | +            if (isset($temp) && is_scalar($temp)) { | 
                                                        |
| 265 | 265 | // value in the middle of the path must be an array  | 
                                                        
| 266 | 266 | $temp = [];  | 
                                                        
| 267 | 267 | }  | 
                                                        
@@ -270,8 +270,8 @@ discard block  | 
                                                    ||
| 270 | 270 | $tempPrevKey = $key;  | 
                                                        
| 271 | 271 | |
| 272 | 272 | // go to the next nested level  | 
                                                        
| 273 | -            if(is_object($temp)) { | 
                                                        |
| 274 | -                if($strict && !($temp instanceof stdClass) && !ObjectHelper::hasPublicProperty($temp, $key)) { | 
                                                        |
| 273 | +            if (is_object($temp)) { | 
                                                        |
| 274 | +                if ($strict && !($temp instanceof stdClass) && !ObjectHelper::hasPublicProperty($temp, $key)) { | 
                                                        |
| 275 | 275 | throw NestedAccessorException::createAsCannotSetValue($mode, implode($this->pathDelimiter, $path));  | 
                                                        
| 276 | 276 | }  | 
                                                        
| 277 | 277 |                  $temp = &$temp->{$key}; | 
                                                        
@@ -282,18 +282,18 @@ discard block  | 
                                                    ||
| 282 | 282 | }  | 
                                                        
| 283 | 283 | }  | 
                                                        
| 284 | 284 | // now we can save value to the source  | 
                                                        
| 285 | -        switch($mode) { | 
                                                        |
| 285 | +        switch ($mode) { | 
                                                        |
| 286 | 286 | case self::SET_MODE_SET:  | 
                                                        
| 287 | 287 | $temp = $value;  | 
                                                        
| 288 | 288 | break;  | 
                                                        
| 289 | 289 | case self::SET_MODE_APPEND:  | 
                                                        
| 290 | -                if(!is_array($temp) || ArrayHelper::isAssoc($temp)) { | 
                                                        |
| 291 | -                    if($strict) { | 
                                                        |
| 290 | +                if (!is_array($temp) || ArrayHelper::isAssoc($temp)) { | 
                                                        |
| 291 | +                    if ($strict) { | 
                                                        |
| 292 | 292 | throw NestedAccessorException::createAsCannotSetValue(  | 
                                                        
| 293 | 293 | $mode,  | 
                                                        
| 294 | 294 | implode($this->pathDelimiter, $path)  | 
                                                        
| 295 | 295 | );  | 
                                                        
| 296 | -                    } elseif(!is_array($temp)) { | 
                                                        |
| 296 | +                    } elseif (!is_array($temp)) { | 
                                                        |
| 297 | 297 | $temp = [];  | 
                                                        
| 298 | 298 | }  | 
                                                        
| 299 | 299 | }  | 
                                                        
@@ -301,8 +301,8 @@ discard block  | 
                                                    ||
| 301 | 301 | $temp[] = $value;  | 
                                                        
| 302 | 302 | break;  | 
                                                        
| 303 | 303 | case self::SET_MODE_DELETE:  | 
                                                        
| 304 | -                if($tempPrevKey === null || (!is_array($tempPrevSource) && !($tempPrevSource instanceof stdClass))) { | 
                                                        |
| 305 | -                    if($strict) { | 
                                                        |
| 304 | +                if ($tempPrevKey === null || (!is_array($tempPrevSource) && !($tempPrevSource instanceof stdClass))) { | 
                                                        |
| 305 | +                    if ($strict) { | 
                                                        |
| 306 | 306 | throw NestedAccessorException::createAsCannotSetValue(  | 
                                                        
| 307 | 307 | $mode,  | 
                                                        
| 308 | 308 | implode($this->pathDelimiter, $path)  | 
                                                        
@@ -311,7 +311,7 @@ discard block  | 
                                                    ||
| 311 | 311 | return $this;  | 
                                                        
| 312 | 312 | }  | 
                                                        
| 313 | 313 | }  | 
                                                        
| 314 | -                if(is_array($tempPrevSource)) { | 
                                                        |
| 314 | +                if (is_array($tempPrevSource)) { | 
                                                        |
| 315 | 315 | unset($tempPrevSource[$tempPrevKey]);  | 
                                                        
| 316 | 316 |                  } else { | 
                                                        
| 317 | 317 |                      unset($tempPrevSource->{$tempPrevKey}); | 
                                                        
@@ -329,11 +329,11 @@ discard block  | 
                                                    ||
| 329 | 329 | */  | 
                                                        
| 330 | 330 | protected function formatPath($path): array  | 
                                                        
| 331 | 331 |      { | 
                                                        
| 332 | -        if(is_array($path)) { | 
                                                        |
| 332 | +        if (is_array($path)) { | 
                                                        |
| 333 | 333 | return $path;  | 
                                                        
| 334 | 334 | }  | 
                                                        
| 335 | 335 | |
| 336 | -        if($path === null || $path === '') { | 
                                                        |
| 336 | +        if ($path === null || $path === '') { | 
                                                        |
| 337 | 337 | return [];  | 
                                                        
| 338 | 338 | }  | 
                                                        
| 339 | 339 | |