Factory
in package
Table of Contents
- TEMPLATE_DEFINITION_FILENAME = 'template.xml'
- $flySystemFactory : FlySystemFactory
- $globalTemplatesPath : string
- $writerCollection : Collection
- __construct() : mixed
- Constructs a new template factory with its dependencies.
- getAllNames() : array<string|int, string>
- Returns a list of all template names.
- getTemplates() : Collection
- Attempts to find, construct and return a template object with the given template name or (relative/absolute) path.
- getTemplatesPath() : string
- Returns the path where all templates are stored.
- createNewFilesystemFromSubfolder() : Filesystem
- createTemplateFromXml() : Template
- Creates and returns a template object based on the provided template definition.
- getTemplatesDirectory() : Filesystem
- loadTemplate() : Template
- resolve() : FilesystemInterface
Constants
TEMPLATE_DEFINITION_FILENAME
public
mixed
TEMPLATE_DEFINITION_FILENAME
= 'template.xml'
Properties
$flySystemFactory
private
FlySystemFactory
$flySystemFactory
$globalTemplatesPath
private
string
$globalTemplatesPath
$writerCollection
private
Collection
$writerCollection
Methods
__construct()
Constructs a new template factory with its dependencies.
public
__construct(Collection $writerCollection, FlySystemFactory $flySystemFactory, string $globalTemplatesPath) : mixed
Parameters
- $writerCollection : Collection
- $flySystemFactory : FlySystemFactory
- $globalTemplatesPath : string
Return values
mixed —getAllNames()
Returns a list of all template names.
public
getAllNames() : array<string|int, string>
Return values
array<string|int, string> —getTemplates()
Attempts to find, construct and return a template object with the given template name or (relative/absolute) path.
public
getTemplates(array<int, array{name: string, parameters: array}> $templates, FilesystemInterface $output) : Collection
Parameters
-
$templates
: array<int, array{name: string, parameters: array
}> - $output : FilesystemInterface
Return values
Collection —getTemplatesPath()
Returns the path where all templates are stored.
public
getTemplatesPath() : string
Return values
string —createNewFilesystemFromSubfolder()
private
createNewFilesystemFromSubfolder(Filesystem $hostFilesystem, string $subfolder) : Filesystem
Parameters
- $hostFilesystem : Filesystem
- $subfolder : string
Return values
Filesystem —createTemplateFromXml()
Creates and returns a template object based on the provided template definition.
private
createTemplateFromXml(FilesystemInterface $filesystem, string $nameOrPath, array<string, string> $templateParams) : Template
Parameters
- $filesystem : FilesystemInterface
- $nameOrPath : string
- $templateParams : array<string, string>
Return values
Template —getTemplatesDirectory()
private
getTemplatesDirectory() : Filesystem
Return values
Filesystem —loadTemplate()
private
loadTemplate(FilesystemInterface $output, string $template, array<string, string> $parameters) : Template
Parameters
- $output : FilesystemInterface
- $template : string
- $parameters : array<string, string>
Return values
Template —resolve()
private
resolve(string $nameOrPath) : FilesystemInterface
Parameters
- $nameOrPath : string