NamespaceTreeBuilder
extends ApiDocumentationPass
in package
Rebuilds the namespace tree from the elements found in files.
On every compiler pass is the namespace tree rebuild to aid in the process of incremental updates. The Files Collection in the Project Descriptor is the only location where aliases to elements may be serialized.
If the namespace tree were to be persisted then both locations needed to be invalidated if a file were to change.
Attributes
- #[Stage]
- 'phpdoc.pipeline.api_documentation.compile'
- 9000
- 'Build "namespaces" index and add namespaces to "elements"'
Table of Contents
Methods
- __invoke() : CompilableSubject
- Executes a compiler pass.
- getDescription() : string
- Returns a textual description of what this pass does for output purposes.
- addElementsOfTypeToNamespace() : void
- Adds the given elements of a specific type to their respective Namespace Descriptors.
- process() : ApiSetDescriptor
- Actual method executed by the compiler.
- addToParentNamespace() : void
Methods
__invoke()
Executes a compiler pass.
public
final __invoke(CompilableSubject $subject) : CompilableSubject
This method will execute the business logic associated with a given compiler pass and allow it to manipulate or consumer the Object Graph using the ProjectDescriptor object.
Parameters
- $subject : CompilableSubject
-
Representation of the Object Graph that can be manipulated.
Return values
CompilableSubjectgetDescription()
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 (
Return values
stringaddElementsOfTypeToNamespace()
Adds the given elements of a specific type to their respective Namespace Descriptors.
protected
addElementsOfTypeToNamespace(DocumentationSetDescriptor $documentationSet, array<string|int, ElementInterface> $elements, string $type) : void
This method will assign the given elements to the namespace as registered in the namespace field of that element. If a namespace does not exist yet it will automatically be created.
Parameters
- $documentationSet : DocumentationSetDescriptor
- $elements : array<string|int, ElementInterface>
-
Series of elements to add to their respective namespace.
- $type : string
-
Declares which field of the namespace will be populated with the given series of elements. This name will be transformed to a getter which must exist. Out of performance considerations will no effort be done to verify whether the provided type is valid.
process()
Actual method executed by the compiler.
protected
process(ApiSetDescriptor $subject) : ApiSetDescriptor
Processes the given ApiSetDescriptor and returns the modified ApiSetDescriptor.
Parameters
- $subject : ApiSetDescriptor
Return values
ApiSetDescriptoraddToParentNamespace()
private
addToParentNamespace(DocumentationSetDescriptor $documentationSet, NamespaceInterface $namespace) : void
Parameters
- $documentationSet : DocumentationSetDescriptor
- $namespace : NamespaceInterface