ProjectFactory
in package
implements
ProjectFactory
Factory class to transform files into a project description.
Interfaces, Classes and Traits
- ProjectFactory
- Interface for project factories. A project factory shall convert a set of files into an object implementing the Project interface.
Table of Contents
- $strategies : ProjectFactoryStrategies
- __construct() : mixed
- Initializes the factory with a number of strategies.
- addStrategy() : void
- create() : Project
- Creates a project from the set of files.
- createInstance() : self
- Creates a new instance of this factory. With all default strategies.
- buildNamespace() : void
- Adds all elements belonging to the namespace to the namespace.
- buildNamespaces() : void
- Builds the namespace tree with all elements in the project.
- getNamespaceByName() : Namespace_
- Gets Namespace from the project if it exists, otherwise returns a new namepace
Properties
$strategies
private
ProjectFactoryStrategies
$strategies
Methods
__construct()
Initializes the factory with a number of strategies.
public
__construct(array<string|int, ProjectFactoryStrategy>|ProjectFactoryStrategies $strategies) : mixed
Parameters
- $strategies : array<string|int, ProjectFactoryStrategy>|ProjectFactoryStrategies
Return values
mixed —addStrategy()
public
addStrategy(ProjectFactoryStrategy $strategy[, int $priority = ProjectFactoryStrategies::DEFAULT_PRIORITY ]) : void
Parameters
- $strategy : ProjectFactoryStrategy
- $priority : int = ProjectFactoryStrategies::DEFAULT_PRIORITY
Return values
void —create()
Creates a project from the set of files.
public
create(string $name, array<string|int, File> $files) : Project
Parameters
- $name : string
- $files : array<string|int, File>
Tags
Return values
Project —createInstance()
Creates a new instance of this factory. With all default strategies.
public
static createInstance() : self
Return values
self —buildNamespace()
Adds all elements belonging to the namespace to the namespace.
private
buildNamespace(File $file, Namespace_ $namespace) : void
Parameters
- $file : File
- $namespace : Namespace_
Return values
void —buildNamespaces()
Builds the namespace tree with all elements in the project.
private
buildNamespaces(Project $project) : void
Parameters
- $project : Project
Return values
void —getNamespaceByName()
Gets Namespace from the project if it exists, otherwise returns a new namepace
private
getNamespaceByName(Project $project, string $name) : Namespace_
Parameters
- $project : Project
- $name : string