src/Node.php
public function validateCanHaveParentOfType()
    {
        if (is_null($this->parent))
        {
            return;
        }

        $allowedNodeTypes = json_decode($this->parent->getNodeType()->allowed_children);

        if (empty($allowedNodeTypes) || in_array($this->getNodeTypeKey(), $allowedNodeTypes))
        {
            return;
        }

        throw new InvalidParentNodeTypeException('Parent does not allow node type of name "' . $this->getNodeTypeName() . '" as child.');
    }
public function validateCanHaveParentOfType()
    {
        if (is_null($this->parent))
        {
            return;
        }

        $allowedNodeTypes = json_decode($this->parent->getNodeType()->allowed_children);

        if (empty($allowedNodeTypes) || in_array($this->getNodeTypeKey(), $allowedNodeTypes))
        {
            return;
        }

        throw new InvalidParentNodeTypeException('Parent does not allow node type of name "' . $this->getNodeTypeName() . '" as child.');
    }
public function validateCanHaveParentOfType ( ) { if ( is_null ( $ this -> parent ) ) { return ; } $ allowedNodeTypes = json_decode ( $ this -> parent -> getNodeType ( ) -> allowed_children ) ; if ( empty ( $ allowedNodeTypes ) || in_array ( $ this -> getNodeTypeKey ( ) , $ allowedNodeTypes ) ) { return ; } throw new InvalidParentNodeTypeException ( 'Parent does not allow node type of name "' . $ this -> getNodeTypeName ( ) . '" as child.' ) ; }
Validates parent type
Validates parent type