Documentation

Transformer
in package

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

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
$writers  : Collection
$destination  : FilesystemInterface|null
$eventDispatcher  : EventDispatcherInterface
$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
getTarget()  : string|null
Returns the location where to store the artifacts.
setDestination()  : void
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

represents the priority in the Compiler queue.

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

$target

protected string|null $target = null

Target location where to output the artifacts

Methods

getDescription()

public getDescription() : string
Return values
string

getTarget()

Returns the location where to store the artifacts.

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

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, 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
$template : Template
Tags
uses
Dispatcher

to emit the events surrounding an initialization.

Return values
void

Search results