phpDocumentor

Transformer
in package
implements CompilerPassInterface

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

Interfaces, Classes and Traits

CompilerPassInterface
Represents a single pass / business rule to be executed by the Compiler.

Table of Contents

COMPILER_PRIORITY  = 5000
EVENT_POST_INITIALIZATION  = 'transformer.writer.initialization.post'
EVENT_POST_TRANSFORM  = 'transformer.transform.post'
EVENT_POST_TRANSFORMATION  = 'transformer.transformation.post'
EVENT_PRE_INITIALIZATION  = 'transformer.writer.initialization.pre'
EVENT_PRE_TRANSFORM  = 'transformer.transform.pre'
EVENT_PRE_TRANSFORMATION  = 'transformer.transformation.pre'
$target  : string|null
$templates  : Collection
$transformations  : array<string|int, Transformation>
$writers  : Collection
$destination  : FilesystemInterface|null
$flySystemFactory  : FlySystemFactory
$logger  : LoggerInterface
__construct()  : mixed
Wires the template collection and writer collection to this transformer.
destination()  : FilesystemInterface
execute()  : void
Transforms the given project into a series of artifacts as provided by the templates.
getDescription()  : string
Returns a textual description of what this pass does for output purposes.
getTarget()  : string|null
Returns the location where to store the artifacts.
getTemplates()  : Collection
Returns the list of templates which are going to be adopted.
getTemplatesDirectory()  : Filesystem
setTarget()  : void
Sets the target location where to output the artifacts.
applyTransformationToProject()  : 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.
transformProject()  : void
Applies all given transformations to the provided project.

Constants

COMPILER_PRIORITY

public int COMPILER_PRIORITY = 5000

EVENT_POST_INITIALIZATION

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

EVENT_POST_TRANSFORM

public mixed EVENT_POST_TRANSFORM = 'transformer.transform.post'

EVENT_POST_TRANSFORMATION

public mixed EVENT_POST_TRANSFORMATION = 'transformer.transformation.post'

EVENT_PRE_INITIALIZATION

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

EVENT_PRE_TRANSFORM

public mixed EVENT_PRE_TRANSFORM = 'transformer.transform.pre'

EVENT_PRE_TRANSFORMATION

public mixed EVENT_PRE_TRANSFORMATION = 'transformer.transformation.pre'

Properties

$destination

private FilesystemInterface|null $destination = null

Methods

destination()

public destination() : FilesystemInterface
Return values
FilesystemInterface

execute()

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

public execute(ProjectDescriptor $project) : void
Parameters
$project : ProjectDescriptor

Representation of the Object Graph that can be manipulated.

Return values
void

getDescription()

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

public getDescription() : string

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

Return values
string

getTarget()

Returns the location where to store the artifacts.

public getTarget() : string|null
Return values
string|null

getTemplatesDirectory()

public getTemplatesDirectory() : Filesystem
Return values
Filesystem

setTarget()

Sets the target location where to output the artifacts.

public setTarget(string $target) : void
Parameters
$target : string

The target location where to output the artifacts.

Return values
void

applyTransformationToProject()

Applies the given transformation to the provided project.

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

to emit the events surrounding a transformation.

Return values
void

initializeWriter()

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

private initializeWriter(WriterAbstract $writer, 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.
Parameters
$writer : WriterAbstract
$project : ProjectDescriptor
Tags
uses
Dispatcher

to emit the events surrounding an initialization.

Return values
void

Search results