Neos\Neos\Service\XliffService::setArrayDataValue PHP Method

setArrayDataValue() protected method

Helper method to create the needed json array from a dotted xliff id
protected setArrayDataValue ( array &$arrayPointer, string $key, string $value ) : void
$arrayPointer array
$key string
$value string
return void
    protected function setArrayDataValue(array &$arrayPointer, $key, $value)
    {
        $keys = explode('.', $key);
        // Extract the last key
        $lastKey = array_pop($keys);
        // Walk/build the array to the specified key
        while ($arrayKey = array_shift($keys)) {
            if (!array_key_exists($arrayKey, $arrayPointer)) {
                $arrayPointer[$arrayKey] = array();
            }
            $arrayPointer =& $arrayPointer[$arrayKey];
        }
        // Set the final key
        $arrayPointer[$lastKey] = $value;
    }