public function setByPath($path, NodeInterface $node = null)
    {
        $this->nodesByPath[$path] = $node;
        if ($node !== null) {
            $this->nodesByIdentifier[$node->getIdentifier()] = $node;
        }
    }