phpDocumentor

Transformer

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

Table of Contents

Constants

EVENT_POST_INITIALIZATION  : mixed = 'transformer.writer.initialization.post'
EVENT_POST_TRANSFORM  : mixed = 'transformer.transform.post'
EVENT_POST_TRANSFORMATION  : mixed = 'transformer.transformation.post'
EVENT_PRE_INITIALIZATION  : mixed = 'transformer.writer.initialization.pre'
EVENT_PRE_TRANSFORM  : mixed = 'transformer.transform.pre'
EVENT_PRE_TRANSFORMATION  : mixed = 'transformer.transformation.pre'

Properties

$writers  : Collection
$destination  : FileSystem|null
$eventDispatcher  : EventDispatcherInterface
$logger  : LoggerInterface

Methods

__construct()  : mixed
Wires the template collection and writer collection to this transformer.
destination()  : FileSystem
execute()  : void
Transforms the given project into a series of artifacts as provided by the templates.
getDescription()  : string
applyTransformation()  : void
Applies the given transformation to the provided project.
initializeWriter()  : void
Initializes the given writer using the provided project meta-data.
initializeWriters()  : void
Initializes all writers that are used during this transformation.
transform()  : void
Applies all given transformations to the provided project.

Constants

EVENT_POST_INITIALIZATION

public final mixed EVENT_POST_INITIALIZATION = 'transformer.writer.initialization.post'

EVENT_POST_TRANSFORM

public final mixed EVENT_POST_TRANSFORM = 'transformer.transform.post'

EVENT_POST_TRANSFORMATION

public final mixed EVENT_POST_TRANSFORMATION = 'transformer.transformation.post'

EVENT_PRE_INITIALIZATION

public final mixed EVENT_PRE_INITIALIZATION = 'transformer.writer.initialization.pre'

EVENT_PRE_TRANSFORM

public final mixed EVENT_PRE_TRANSFORM = 'transformer.transform.pre'

EVENT_PRE_TRANSFORMATION

public final mixed EVENT_PRE_TRANSFORMATION = 'transformer.transformation.pre'

Properties

$destination

private FileSystem|null $destination

The destination filesystem to write to

$eventDispatcher read-only

private EventDispatcherInterface $eventDispatcher

Methods

__construct()

Wires the template collection and writer collection to this transformer.

public __construct(Collection $writerCollection, LoggerInterface $logger, EventDispatcherInterface $eventDispatcher) : mixed
Parameters
$writerCollection : Collection
$logger : LoggerInterface
$eventDispatcher : EventDispatcherInterface

destination()

public destination() : FileSystem
Return values
FileSystem

getDescription()

public getDescription() : string
Return values
string

applyTransformation()

Applies the given transformation to the provided project.

private applyTransformation(Transformation $transformation, ProjectDescriptor $project, DocumentationSetDescriptor $documentationSet) : 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
Parameters
$transformation : Transformation
$project : ProjectDescriptor
$documentationSet : DocumentationSetDescriptor
Tags
uses
Dispatcher

to emit the events surrounding a transformation.

initializeWriter()

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

private initializeWriter(WriterAbstract $writer, ProjectDescriptor $project, DocumentationSetDescriptor $documentationSet, Template $template) : 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.
Parameters
$writer : WriterAbstract
$project : ProjectDescriptor
$documentationSet : DocumentationSetDescriptor
$template : Template
Tags
uses
EventDispatcherInterface

to emit the events surrounding an initialization.


        
On this page

Search results