/** * 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)); }