isOfType() public method

If this node type or any of the direct or indirect super types has the given name.
public isOfType ( string $nodeType ) : boolean
$nodeType string
return boolean TRUE if this node type is of the given kind, otherwise FALSE
 /**
  * @test
  */
 public function nodeTypesCanHaveAnyNumberOfSuperTypes()
 {
     $baseType = new NodeType('Neos.ContentRepository:Base', array(), array());
     $folderType = new NodeType('Neos.ContentRepository.Testing:Document', array($baseType), array());
     $hideableNodeType = new NodeType('Neos.ContentRepository.Testing:HideableContent', array(), array());
     $pageType = new NodeType('Neos.ContentRepository.Testing:Page', array($folderType, $hideableNodeType), array());
     $this->assertEquals(array($folderType, $hideableNodeType), $pageType->getDeclaredSuperTypes());
     $this->assertTrue($pageType->isOfType('Neos.ContentRepository.Testing:Page'));
     $this->assertTrue($pageType->isOfType('Neos.ContentRepository.Testing:HideableContent'));
     $this->assertTrue($pageType->isOfType('Neos.ContentRepository.Testing:Document'));
     $this->assertTrue($pageType->isOfType('Neos.ContentRepository:Base'));
     $this->assertFalse($pageType->isOfType('Neos.ContentRepository:Exotic'));
 }
 /**
  * @param NodeType $nodeType The (uninitialized) node type to process
  * @param array $configuration The configuration of the node type
  * @param array $options The processor options
  * @return void
  */
 public function process(NodeType $nodeType, array &$configuration, array $options)
 {
     if ($nodeType->isOfType('Neos.ContentRepository.Testing:NodeTypeWithProcessor')) {
         $someOption = isset($options['someOption']) ? $options['someOption'] : '';
         $someOtherOption = isset($options['someOtherOption']) ? $options['someOtherOption'] : '';
         $configuration['properties']['test1']['defaultValue'] = sprintf('The value of "someOption" is "%s", the value of "someOtherOption" is "%s"', $someOption, $someOtherOption);
     }
 }
 /**
  * This method loops over the constraints and finds node types that the given node type inherits from. For all
  * matched super types, their super types are traversed to find the closest super node with a constraint which
  * is used to evaluated if the node type is allowed. It finds the closest results for true and false, and uses
  * the distance to choose which one wins (lowest). If no result is found the node type is allowed.
  *
  * @param NodeType $nodeType
  * @param array $constraints
  * @return boolean|NULL if no constraint matched
  */
 protected function isNodeTypeAllowedByInheritanceConstraints(NodeType $nodeType, array $constraints)
 {
     $constraintDistanceForTrue = null;
     $constraintDistanceForFalse = null;
     foreach ($constraints as $superType => $constraint) {
         if ($nodeType->isOfType($superType)) {
             $distance = $this->traverseSuperTypes($nodeType, $superType, 0);
             if ($constraint === true && ($constraintDistanceForTrue === null || $constraintDistanceForTrue > $distance)) {
                 $constraintDistanceForTrue = $distance;
             }
             if ($constraint === false && ($constraintDistanceForFalse === null || $constraintDistanceForFalse > $distance)) {
                 $constraintDistanceForFalse = $distance;
             }
         }
     }
     if ($constraintDistanceForTrue !== null && $constraintDistanceForFalse !== null) {
         return $constraintDistanceForTrue < $constraintDistanceForFalse ? true : false;
     }
     if ($constraintDistanceForFalse !== null) {
         return false;
     }
     if ($constraintDistanceForTrue !== null) {
         return true;
     }
     return null;
 }