PHPSpec2\Loader\Node\Specification::getChildren PHP Method

getChildren() public method

public getChildren ( )
    public function getChildren()
    {
        return $this->children;
    }

Usage Example

 public function loadFromFile($filename, $line = null)
 {
     $oldClassnames = get_declared_classes();
     require_once $filename;
     $newClassnames = array_diff(get_declared_classes(), $oldClassnames);
     $specifications = array();
     foreach ($newClassnames as $classname) {
         $class = new ReflectionClass($classname);
         if ($class->isAbstract()) {
             continue;
         }
         if (!$class->implementsInterface('PHPSpec2\\SpecificationInterface')) {
             continue;
         }
         $preFunctions = array();
         if ($class->hasMethod('let')) {
             $preFunctions[] = $class->getMethod('let');
         }
         $postFunctions = array();
         if ($class->hasMethod('letgo')) {
             $postFunctions[] = $class->getMethod('letgo');
         }
         $specification = new Node\Specification($class->getName());
         $subject = $this->getClassSubject($class->getName());
         foreach ($class->getMethods(ReflectionMethod::IS_PUBLIC) as $method) {
             if (!preg_match('/^(it_|its_)/', $method->getName())) {
                 continue;
             }
             if (null !== $line && !$this->lineIsInsideMethod($line, $method)) {
                 continue;
             }
             $example = new Node\Example(str_replace('_', ' ', $method->getName()), $subject, $method);
             array_map(array($example, 'addPreFunction'), $preFunctions);
             array_map(array($example, 'addPostFunction'), $postFunctions);
             $specification->addChild($example);
         }
         if (count($specification->getChildren())) {
             $specifications[] = $specification;
         }
     }
     return $specifications;
 }
All Usage Examples Of PHPSpec2\Loader\Node\Specification::getChildren