Transformer
Core class responsible for transforming the cache file to a set of artifacts.
Table of Contents
Constants
- 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'
Properties
- $target : string|null
- $writers : Collection
- $destination : FilesystemInterface|null
- $eventDispatcher : EventDispatcherInterface
- $flySystemFactory : FlySystemFactory
- $logger : LoggerInterface
Methods
- __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.
- 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
COMPILER_PRIORITY
    public
    final    mixed
    COMPILER_PRIORITY
    = 5000
    
    
    
    
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
$target
        protected
            string|null
    $target
     = null
    
        Target location where to output the artifacts
$writers
        protected
            Collection
    $writers
    
    
    
    
    
    
$destination
        private
            FilesystemInterface|null
    $destination
     = null
    
        The destination filesystem to write to
$eventDispatcher read-only
        private
            EventDispatcherInterface
    $eventDispatcher
    
    
    
    
    
    
$flySystemFactory read-only
        private
            FlySystemFactory
    $flySystemFactory
    
    
    
    
    
    
$logger read-only
        private
            LoggerInterface
    $logger
    
    
    
    
    
    
Methods
__construct()
Wires the template collection and writer collection to this transformer.
    public
                    __construct(Collection $writerCollection, LoggerInterface $logger, FlySystemFactory $flySystemFactory, EventDispatcherInterface $eventDispatcher) : mixed
    Parameters
- $writerCollection : Collection
- $logger : LoggerInterface
- $flySystemFactory : FlySystemFactory
- $eventDispatcher : EventDispatcherInterface
destination()
    public
                    destination() : FilesystemInterface
    Return values
FilesystemInterfaceexecute()
Transforms the given project into a series of artifacts as provided by the templates.
    public
                    execute(ProjectDescriptor $project, DocumentationSetDescriptor $documentationSet, array<string|int, Transformation> $transformations) : void
    Parameters
- $project : ProjectDescriptor
- $documentationSet : DocumentationSetDescriptor
- $transformations : array<string|int, Transformation>
getDescription()
    public
                    getDescription() : string
    Return values
stringgetTarget()
Returns the location where to store the artifacts.
    public
                    getTarget() : string|null
    Return values
string|nullsetDestination()
    public
                    setDestination(FilesystemInterface $filesystem) : void
    Parameters
- $filesystem : FilesystemInterface
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. 
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
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
initializeWriters()
Initializes all writers that are used during this transformation.
    private
                    initializeWriters(ProjectDescriptor $project, DocumentationSetDescriptor $documentationSet, array<string|int, Transformation> $transformations) : void
    Parameters
- $project : ProjectDescriptor
- $documentationSet : DocumentationSetDescriptor
- $transformations : array<string|int, Transformation>
transform()
Applies all given transformations to the provided project.
    private
                    transform(ProjectDescriptor $project, DocumentationSetDescriptor $documentationSet, array<string|int, Transformation> $transformations) : void
    Parameters
- $project : ProjectDescriptor
- $documentationSet : DocumentationSetDescriptor
- $transformations : array<string|int, Transformation>