Create array if not existing

This commit is contained in:
Dennis Eichhorn 2018-08-28 20:17:22 +02:00 committed by GitHub
parent a022348e47
commit a37dd5e792
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -95,9 +95,17 @@ final class ArrayUtils
if ($pathParts === false) {
throw new \Exception();
}
$pathPartCount = \count($pathParts);
$c = 1;
foreach ($pathParts as $key) {
if (!isset($current[$key]) && $pathPartCount < $c) {
$current = [];
}
$current = &$current[$key];
++$c;
}
if ($overwrite) {