private function storeValue(NodePath $nodePath, array $data, string $property, $value) : array
    {
        $nodePath = $nodePath->popFirst($nodeName);
        $nodeName = $this->encodeNodeName($nodeName);
        if (!isset($data[$nodeName])) {
            $data[$nodeName] = [];
        }
        if ($nodePath->isEmpty()) {
            // we arrived at the target, check if the value is not set already
            if (!empty($data[$nodeName][$property]) && ($data[$nodeName][$property] != $value)) {
                throw new InconsistentValueException("Attempting to overwrite '$property' value '"
                    . $data[$nodeName][$property] . "' with '$value'.");
            }
            $data[$nodeName][$property] = $value;
        } else {
            $data[$nodeName] = $this->storeValue($nodePath, $data[$nodeName], $property, $value);
        }
        return $data;
    }
private function storeValue(NodePath $nodePath, array $data, string $property, $value) : array
    {
        $nodePath = $nodePath->popFirst($nodeName);
        $nodeName = $this->encodeNodeName($nodeName);
        if (!isset($data[$nodeName])) {
            $data[$nodeName] = [];
        }
        if ($nodePath->isEmpty()) {
            // we arrived at the target, check if the value is not set already
            if (!empty($data[$nodeName][$property]) && ($data[$nodeName][$property] != $value)) {
                throw new InconsistentValueException("Attempting to overwrite '$property' value '"
                    . $data[$nodeName][$property] . "' with '$value'.");
            }
            $data[$nodeName][$property] = $value;
        } else {
            $data[$nodeName] = $this->storeValue($nodePath, $data[$nodeName], $property, $value);
        }
        return $data;
    }
private function storeValue ( NodePath $ nodePath , array $ data , string $ property , $ value ) : array { $ nodePath = $ nodePath -> popFirst ( $ nodeName ) ; $ nodeName = $ this -> encodeNodeName ( $ nodeName ) ; if ( ! isset ( $ data [ $ nodeName ] ) ) { $ data [ $ nodeName ] = [ ] ; } if ( $ nodePath -> isEmpty ( ) ) { // we arrived at the target, check if the value is not set already if ( ! empty ( $ data [ $ nodeName ] [ $ property ] ) && ( $ data [ $ nodeName ] [ $ property ] != $ value ) ) { throw new InconsistentValueException ( "Attempting to overwrite '$property' value '" . $ data [ $ nodeName ] [ $ property ] . "' with '$value'." ) ; } $ data [ $ nodeName ] [ $ property ] = $ value ; } else { $ data [ $ nodeName ] = $ this -> storeValue ( $ nodePath , $ data [ $ nodeName ] , $ property , $ value ) ; } return $ data ; }
Store a particular value of a particular property for a given node.
@param NodePath $nodePath Node Path
@param array $data Structure data.
@param string $property Name of the property (e.g. 'nodeType')
@param mixed $value Scalar value of the property.
@return array Structure data
@throws InconsistentValueException In case the values is already set and not same.
Store a particular value of a particular property for a given node .