Jackalope\NodeType\NodeTypeManager::getNodeType PHP Method

getNodeType() public method

{@inheritDoc}
public getNodeType ( $nodeTypeName )
    public function getNodeType($nodeTypeName)
    {
        if (null === $nodeTypeName) {
            throw new NoSuchNodeTypeException('nodeTypeName is <null>');
        }
        if ('' === $nodeTypeName) {
            throw new NoSuchNodeTypeException('nodeTypeName is empty string');
        }
        if ($nodeTypeName[0] === '{') {
            list($uri, $name) = explode('}', substr($nodeTypeName, 1));
            $prefix = $this->namespaceRegistry->getPrefix($uri);
            $nodeTypeName = "{$prefix}:{$name}";
        }
        $this->fetchNodeTypes($nodeTypeName);
        if (isset($this->primaryTypes[$nodeTypeName])) {
            return $this->primaryTypes[$nodeTypeName];
        }
        if (isset($this->mixinTypes[$nodeTypeName])) {
            return $this->mixinTypes[$nodeTypeName];
        }
        throw new NoSuchNodeTypeException($nodeTypeName);
    }

Usage Example

 /**
  * @covers Jackalope\NodeTYpe\NodeTypeTemplate::getPropertyDefinitionTemplates
  */
 public function testPropertyDefinitionTemplatesMutable()
 {
     $nt = $this->ntm->getNodeType('nt:file');
     $newnt = $this->ntm->createNodeTypeTemplate($nt);
     $property = $this->ntm->createPropertyDefinitionTemplate();
     $property->setName('test:propdef');
     $properties = $newnt->getPropertyDefinitionTemplates();
     $this->assertInstanceOf('ArrayObject', $properties);
     $properties[] = $property;
     $propertiesAgain = $newnt->getPropertyDefinitionTemplates();
     $this->assertInstanceOf('ArrayObject', $propertiesAgain);
     $this->assertCount(1, $propertiesAgain);
     $propertiesArray = $propertiesAgain->getArrayCopy();
     $this->assertSame($property, reset($propertiesArray));
     $this->assertEquals('test:propdef', reset($propertiesArray)->getName());
 }
All Usage Examples Of Jackalope\NodeType\NodeTypeManager::getNodeType