M1\Vars\Resource\AbstractResource::internalSet PHP Method

internalSet() private method

Object oriented set access for the array
private internalSet ( array &$array, mixed $key, mixed $value ) : array
$array array The array to use -- will always be based on $this->content but can be used recursively
$key mixed The key to set the value for
$value mixed The value to set
return array Returns the modified array
    private function internalSet(array &$array, $key, $value)
    {
        if (is_null($key)) {
            return $array = $value;
        }
        $keys = explode('.', $key);
        while (count($keys) > 1) {
            $key = array_shift($keys);
            if (!isset($array[$key]) || !is_array($array[$key])) {
                $array[$key] = [];
            }
            $array =& $array[$key];
        }
        $array[array_shift($keys)] = $value;
        return $array;
    }