original_string: 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.');
      }
code: 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.');
      }
code_tokens: 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.' ) ; }
docstring: Validates parent type
docstring_tokens: Validates parent type