/** * Applies all behaviours prior to transformation. * * @param \phpDocumentor\Transformer\Events\PreTransformationEvent $data * Event object containing the parameters. * * @phpdoc-event transformer.transform.pre * * @return void */ public function applyBehaviours($data) { if (!$data->getSubject() instanceof \phpDocumentor\Transformer\Transformer) { throw new Exception('Unable to apply behaviours, the invoking object is not a ' . '\\phpDocumentor\\Transformer\\Transformer'); } $behaviours = new Transformer\Behaviour\Collection($data->getSubject(), array(new Transformer\Behaviour\GeneratePaths(), new Transformer\Behaviour\Inherit(), new Transformer\Behaviour\Tag\IgnoreTag(), new Transformer\Behaviour\Tag\ReturnTag(), new Transformer\Behaviour\Tag\ParamTag(), new Transformer\Behaviour\Tag\VarTag(), new Transformer\Behaviour\Tag\PropertyTag(), new Transformer\Behaviour\Tag\MethodTag(), new Transformer\Behaviour\Tag\UsesTag(), new Transformer\Behaviour\Tag\CoversTag(), new Transformer\Behaviour\Tag\AuthorTag(), new Transformer\Behaviour\Tag\LicenseTag(), new Transformer\Behaviour\Tag\InternalTag(), new Transformer\Behaviour\AddLinkInformation())); $data->setSource($behaviours->process($data->getSource())); }
/** * Executes each transformation. * * @return void */ public function execute() { $source = $this->getSource(); if (!$source) { throw new Exception('Unable to process transformations; the source was not set ' . 'correctly'); } // invoke pre-transform actions (i.e. enhance source file with additional // meta-data) \phpDocumentor\Plugin\EventDispatcher::getInstance()->dispatch('transformer.transform.pre', \phpDocumentor\Transformer\Events\PreTransformEvent::createInstance($this)->setSource($source)); foreach ($this->getTransformations() as $transformation) { \phpDocumentor\Plugin\EventDispatcher::getInstance()->dispatch('transformer.transformation.pre', \phpDocumentor\Transformer\Events\PreTransformationEvent::createInstance($this)->setSource($source)); $this->log('Applying transformation' . ($transformation->getQuery() ? ' query "' . $transformation->getQuery() . '"' : '') . ' using writer ' . get_class($transformation->getWriter()) . ' on ' . $transformation->getArtifact()); $transformation->execute($source); \phpDocumentor\Plugin\EventDispatcher::getInstance()->dispatch('transformer.transformation.post', \phpDocumentor\Transformer\Events\PostTransformationEvent::createInstance($this)->setSource($source)); } \phpDocumentor\Plugin\EventDispatcher::getInstance()->dispatch('transformer.transform.post', \phpDocumentor\Transformer\Events\PostTransformEvent::createInstance($this)->setSource($source)); }