Jackalope\NodeType\NodeTypeDefinition::__construct PHP Method

__construct() public method

Optionally initializes the data from XML, an array or another NodeTypeDefinition.
public __construct ( Jackalope\FactoryInterface $factory, NodeTypeManager $nodeTypeManager, $nodetype = null )
$factory Jackalope\FactoryInterface the object factory
$nodeTypeManager NodeTypeManager
$nodetype Either by XML or by NodeTypeDefinition or null for an empty definition
    public function __construct(FactoryInterface $factory, NodeTypeManager $nodeTypeManager, $nodetype = null)
    {
        $this->factory = $factory;
        $this->valueConverter = $this->factory->get('PHPCR\\Util\\ValueConverter');
        $this->nodeTypeManager = $nodeTypeManager;
        if ($nodetype instanceof DOMElement) {
            $this->fromXml($nodetype);
        } elseif (is_array($nodetype)) {
            $this->fromArray($nodetype);
        } elseif ($nodetype instanceof NodeTypeDefinitionInterface) {
            $this->fromNodeTypeDefinition($nodetype);
            // copy constructor
        } elseif (!is_null($nodetype)) {
            throw new InvalidArgumentException('Implementation Error -- unknown nodetype class: ' . get_class($nodetype));
        }
    }