ApiGen\Templating\TemplateFactory::createForType PHP Méthode

createForType() public méthode

public createForType ( string $type ) : ApiGen\Templating\Template
$type string
Résultat ApiGen\Templating\Template
    public function createForType($type)
    {
        $template = $this->buildTemplate();
        $template->setFile($this->templateNavigator->getTemplatePath($type));
        $template->setSavePath($this->templateNavigator->getTemplateFileName($type));
        $template = $this->setEmptyDefaults($template);
        return $template;
    }

Usage Example

 public function generate()
 {
     $template = $this->templateFactory->createForType(TCO::TREE);
     $classes = $this->parserResult->getClasses();
     foreach ($classes as $className => $reflection) {
         if ($this->canBeProcessed($reflection)) {
             $this->addToTreeByReflection($reflection);
         }
     }
     $this->sortTreeStorageElements();
     $template->setParameters(['classTree' => new Tree($this->treeStorage[Elements::CLASSES], $classes), 'interfaceTree' => new Tree($this->treeStorage[Elements::INTERFACES], $classes), 'traitTree' => new Tree($this->treeStorage[Elements::TRAITS], $classes), 'exceptionTree' => new Tree($this->treeStorage[Elements::EXCEPTIONS], $classes)]);
     $template->save();
 }
All Usage Examples Of ApiGen\Templating\TemplateFactory::createForType