protected function assignArrayByDotPath(&$arr, string $path, string $value)
    {
        $keys = explode('.', $path);

        // Check that no key have a '0' value
        // This is because the '0' key is not read
        foreach ($keys as $keyValue) {
            if ($keyValue == '0') {
                throw new InvalidArgumentException('Invalid key in input array: part of the key in dot notation can NOT be \'0\'.');
            }
        }

        // Check if the allowed maximum level of nested array is exceeded
        $nestingLevels = count($keys);

        if ($nestingLevels > $this->allowedNestedArrays) {
            throw new TooManyNestedArraysException("Too many nested arrays in the input arrays. Maximum allowed is: " . $this->allowedNestedArrays);
        }

        while ($key = array_shift($keys)) {
            $arr = &$arr[$key];
        }

        $arr = $value;
    }
protected function assignArrayByDotPath(&$arr, string $path, string $value)
    {
        $keys = explode('.', $path);

        // Check that no key have a '0' value
        // This is because the '0' key is not read
        foreach ($keys as $keyValue) {
            if ($keyValue == '0') {
                throw new InvalidArgumentException('Invalid key in input array: part of the key in dot notation can NOT be \'0\'.');
            }
        }

        // Check if the allowed maximum level of nested array is exceeded
        $nestingLevels = count($keys);

        if ($nestingLevels > $this->allowedNestedArrays) {
            throw new TooManyNestedArraysException("Too many nested arrays in the input arrays. Maximum allowed is: " . $this->allowedNestedArrays);
        }

        while ($key = array_shift($keys)) {
            $arr = &$arr[$key];
        }

        $arr = $value;
    }
protected function assignArrayByDotPath ( & $ arr , string $ path , string $ value ) { $ keys = explode ( '.' , $ path ) ; // Check that no key have a '0' value // This is because the '0' key is not read foreach ( $ keys as $ keyValue ) { if ( $ keyValue == '0' ) { throw new InvalidArgumentException ( 'Invalid key in input array: part of the key in dot notation can NOT be \'0\'.' ) ; } } // Check if the allowed maximum level of nested array is exceeded $ nestingLevels = count ( $ keys ) ; if ( $ nestingLevels > $ this -> allowedNestedArrays ) { throw new TooManyNestedArraysException ( "Too many nested arrays in the input arrays. Maximum allowed is: " . $ this -> allowedNestedArrays ) ; } while ( $ key = array_shift ( $ keys ) ) { $ arr = & $ arr [ $ key ] ; } $ arr = $ value ; }
Take a path of nested array with dot notation and build an array, saving it through reference.

@param  array $arr
@param  string $path
@param  string $value

@throws InvalidArgumentException
@throws TooManyNestedArraysException
Take a path of nested array with dot notation and build an array saving it through reference .