Neos.Fusion/Classes/Core/Parser.php
protected function setValueInObjectTree(array $objectPathArray, $value, &$objectTree = null)
    {
        if ($objectTree === null) {
            $objectTree = &$this->objectTree;
        }

        $currentKey = array_shift($objectPathArray);
        if (is_numeric($currentKey)) {
            $currentKey = (int)$currentKey;
        }

        if (empty($objectPathArray)) {
            // last part of the iteration, setting the final value
            if (isset($objectTree[$currentKey]) && $value === null) {
                unset($objectTree[$currentKey]);
            } elseif (isset($objectTree[$currentKey]) && is_array($objectTree[$currentKey])) {
                if (is_array($value)) {
                    $objectTree[$currentKey] = Arrays::arrayMergeRecursiveOverrule($objectTree[$currentKey], $value);
                } else {
                    $objectTree[$currentKey]['__value'] = $value;
                    $objectTree[$currentKey]['__eelExpression'] = null;
                    $objectTree[$currentKey]['__objectType'] = null;
                }
            } else {
                $objectTree[$currentKey] = $value;
            }
        } else {
            // we still need to traverse further down
            if (isset($objectTree[$currentKey]) && !is_array($objectTree[$currentKey])) {
                // the element one-level-down is already defined, but it is NOT an array. So we need to convert the simple type to __value
                $objectTree[$currentKey] = [
                    '__value' => $objectTree[$currentKey],
                    '__eelExpression' => null,
                    '__objectType' => null
                ];
            } elseif (!isset($objectTree[$currentKey])) {
                $objectTree[$currentKey] = [];
            }

            $this->setValueInObjectTree($objectPathArray, $value, $objectTree[$currentKey]);
        }

        return $objectTree;
    }
protected function setValueInObjectTree(array $objectPathArray, $value, &$objectTree = null)
    {
        if ($objectTree === null) {
            $objectTree = &$this->objectTree;
        }

        $currentKey = array_shift($objectPathArray);
        if (is_numeric($currentKey)) {
            $currentKey = (int)$currentKey;
        }

        if (empty($objectPathArray)) {
            // last part of the iteration, setting the final value
            if (isset($objectTree[$currentKey]) && $value === null) {
                unset($objectTree[$currentKey]);
            } elseif (isset($objectTree[$currentKey]) && is_array($objectTree[$currentKey])) {
                if (is_array($value)) {
                    $objectTree[$currentKey] = Arrays::arrayMergeRecursiveOverrule($objectTree[$currentKey], $value);
                } else {
                    $objectTree[$currentKey]['__value'] = $value;
                    $objectTree[$currentKey]['__eelExpression'] = null;
                    $objectTree[$currentKey]['__objectType'] = null;
                }
            } else {
                $objectTree[$currentKey] = $value;
            }
        } else {
            // we still need to traverse further down
            if (isset($objectTree[$currentKey]) && !is_array($objectTree[$currentKey])) {
                // the element one-level-down is already defined, but it is NOT an array. So we need to convert the simple type to __value
                $objectTree[$currentKey] = [
                    '__value' => $objectTree[$currentKey],
                    '__eelExpression' => null,
                    '__objectType' => null
                ];
            } elseif (!isset($objectTree[$currentKey])) {
                $objectTree[$currentKey] = [];
            }

            $this->setValueInObjectTree($objectPathArray, $value, $objectTree[$currentKey]);
        }

        return $objectTree;
    }
protected function setValueInObjectTree ( array $ objectPathArray , $ value , & $ objectTree = null ) { if ( $ objectTree === null ) { $ objectTree = & $ this -> objectTree ; } $ currentKey = array_shift ( $ objectPathArray ) ; if ( is_numeric ( $ currentKey ) ) { $ currentKey = ( int ) $ currentKey ; } if ( empty ( $ objectPathArray ) ) { // last part of the iteration, setting the final value if ( isset ( $ objectTree [ $ currentKey ] ) && $ value === null ) { unset ( $ objectTree [ $ currentKey ] ) ; } elseif ( isset ( $ objectTree [ $ currentKey ] ) && is_array ( $ objectTree [ $ currentKey ] ) ) { if ( is_array ( $ value ) ) { $ objectTree [ $ currentKey ] = Arrays :: arrayMergeRecursiveOverrule ( $ objectTree [ $ currentKey ] , $ value ) ; } else { $ objectTree [ $ currentKey ] [ '__value' ] = $ value ; $ objectTree [ $ currentKey ] [ '__eelExpression' ] = null ; $ objectTree [ $ currentKey ] [ '__objectType' ] = null ; } } else { $ objectTree [ $ currentKey ] = $ value ; } } else { // we still need to traverse further down if ( isset ( $ objectTree [ $ currentKey ] ) && ! is_array ( $ objectTree [ $ currentKey ] ) ) { // the element one-level-down is already defined, but it is NOT an array. So we need to convert the simple type to __value $ objectTree [ $ currentKey ] = [ '__value' => $ objectTree [ $ currentKey ] , '__eelExpression' => null , '__objectType' => null ] ; } elseif ( ! isset ( $ objectTree [ $ currentKey ] ) ) { $ objectTree [ $ currentKey ] = [ ] ; } $ this -> setValueInObjectTree ( $ objectPathArray , $ value , $ objectTree [ $ currentKey ] ) ; } return $ objectTree ; }
Assigns a value to a node or a property in the object tree, specified by the object path array.

@param array $objectPathArray The object path, specifying the node / property to set
@param mixed $value The value to assign, is a non-array type or an array with __eelExpression etc.
@param array $objectTree The current (sub-) tree, used internally - don't specify!
@return array The modified object tree
Assigns a value to a node or a property in the object tree specified by the object path array .