Transformer

Implements \phpDocumentor\Compiler\CompilerPassInterface

Core class responsible for transforming the cache file to a set of artifacts.

package

Default

Methods

Wires the template collection and writer collection to this transformer.

__construct(\phpDocumentor\Transformer\Template\Collection $templateCollection, \phpDocumentor\Transformer\Writer\Collection $writerCollection) 

Applies the given transformation to the provided project.

applyTransformationToProject(\phpDocumentor\Transformer\Transformation $transformation, \phpDocumentor\Descriptor\ProjectDescriptor $project) : void

This method will attempt to find an appropriate writer for the given transformation and invoke that with the transformation and project so that an artifact can be generated that matches the intended transformation.

In addition this method will emit the following events:

  • transformer.transformation.pre, before the project has been transformed with this transformation.
  • transformer.transformation.post, after the project has been transformed with this transformation
uses

to emit the events surrounding a transformation.

Arguments

Dispatches a logging request to log a debug message.

debug(string $message) : void

Arguments

$message

string

The message to log.

Transforms the given project into a series of artifacts as provided by the templates.

execute(\phpDocumentor\Descriptor\ProjectDescriptor $project) : void

This method will execute the business logic associated with a given compiler pass and allow it to manipulate or consumer the Object Graph using the ProjectDescriptor object.

Arguments

$project

\phpDocumentor\Descriptor\ProjectDescriptor

Representation of the Object Graph that can be manipulated.

Converts a source file name to the name used for generating the end result.

generateFilename(string $name) : string

This method strips down the given $name using the following rules:

  • if the $name is suffixed with .php then that is removed
  • any occurrence of \ or DIRECTORY_SEPARATOR is replaced with .
  • any dots that the name starts or ends with is removed
  • the result is suffixed with .html

Arguments

$name

string

Name to convert.

Response

string

Returns a textual description of what this pass does for output purposes.

getDescription() : string

Please note that the command line will be truncated to 68 characters ( .. 000.000s) so longer descriptions won't have much use.

Response

string

Returns the location where to store the artifacts.

getTarget() : string

Response

string

Returns the list of templates which are going to be adopted.

getTemplates() : \phpDocumentor\Transformer\Template\Collection

Initializes the given writer using the provided project meta-data.

initializeWriter(\phpDocumentor\Transformer\Writer\WriterAbstract $writer, \phpDocumentor\Descriptor\ProjectDescriptor $project) : void

This method wil call for the initialization of each writer that supports an initialization routine (as defined by the Initializable interface).

In addition to this, the following events emitted for each writer that is present in the collected list of transformations, even those that do not implement the Initializable interface.

Emitted events:

  • transformer.writer.initialization.pre, before the initialization of a single writer.
  • transformer.writer.initialization.post, after the initialization of a single writer.
uses

to emit the events surrounding an initialization.

Arguments

Initializes all writers that are used during this transformation.

initializeWriters(\phpDocumentor\Descriptor\ProjectDescriptor $project, array<mixed,\phpDocumentor\Transformer\Transformation> $transformations) : void

Dispatches a logging request.

log(string $message, string $priority = \Psr\Log\LogLevel::INFO) : void

Arguments

$message

string

The message to log.

$priority

string

The logging priority

Sets the target location where to output the artifacts.

setTarget(string $target) : void
Throws
\InvalidArgumentException

if the target is not a valid writable directory.

Arguments

$target

string

The target location where to output the artifacts.

Applies all given transformations to the provided project.

transformProject(\phpDocumentor\Descriptor\ProjectDescriptor $project, array<mixed,\phpDocumentor\Transformer\Transformation> $transformations) : void

Constants

EVENT_PRE_TRANSFORMATION

EVENT_PRE_TRANSFORMATION

EVENT_POST_TRANSFORMATION

EVENT_POST_TRANSFORMATION

EVENT_PRE_INITIALIZATION

EVENT_PRE_INITIALIZATION

EVENT_POST_INITIALIZATION

EVENT_POST_INITIALIZATION

EVENT_PRE_TRANSFORM

EVENT_PRE_TRANSFORM

EVENT_POST_TRANSFORM

EVENT_POST_TRANSFORM

COMPILER_PRIORITY

COMPILER_PRIORITY
var

represents the priority in the Compiler queue.

Properties

Target location where to output the artifacts

target : string|null
var

Target location where to output the artifacts

Type(s)

string|null

templates

templates : \phpDocumentor\Transformer\Template\Collection

writers

writers : \phpDocumentor\Transformer\Writer\Collection|array<mixed,\phpDocumentor\Transformer\Writer\WriterAbstract>

transformations

transformations : array<mixed,\phpDocumentor\Transformer\Transformation>