Extension
extends AbstractExtension
in package
implements
ExtensionInterface, GlobalsInterface
Basic extension adding phpDocumentor specific functionality for Twig templates.
Global variables:
- ast_node, the current $data element
Functions:
- *path(string) *, converts the given relative path to be based of the projects root instead of the current directory
Filters:
- markdown, converts the associated text from Markdown formatting to HTML.
- trans, translates the given string
- route, attempts to generate a URL for a given Descriptor
- sort_desc, sorts the given objects by their Name property/getter in a descending fashion
- sort_asc, sorts the given objects by their Name property/getter in a ascending fashion
Table of Contents
Interfaces
- ExtensionInterface
- An interface shared by all Twig interfaces intended for phpDocumentor.
- GlobalsInterface
- Allows Twig extensions to add globals to the context.
Properties
- $documentationSet : DocumentationSetDescriptor
- $markdownConverter : ConverterInterface
- $pathBuilder : PathBuilder
- $project : ProjectDescriptor
- $relativePathToRootConverter : RelativePathToRootConverter
- $routeRenderer : LinkRenderer
Methods
- __construct() : mixed
- Registers the structure and transformation with this extension.
- getExpressionParsers() : array<string|int, mixed>
- getFilters() : array<string|int, TwigFilter>
- Returns a list of all filters that are exposed by this extension.
- getFunctions() : array<string|int, TwigFunction>
- Returns a listing of all functions that this extension adds.
-
getGlobals()
: Descriptor, usesNamespaces: bool, usesPackages: bool, destinationPath: ?string, parameter: array
, env: mixed} - Initialize series of globals used by the writers to set the context
- getLastModified() : int
- Returns the last modification time of the extension for cache invalidation.
- getNodeVisitors() : array<string|int, NodeVisitorInterface>
- Returns the node visitor instances to add to the existing list.
- getOperators() : array<string|int, array<string|int, mixed>>
- Returns a list of operators to add to the existing list.
- getTests() : array<int, TwigTest>
- Returns a list of tests to add to the existing list.
- getTokenParsers() : array<string|int, TokenParserInterface>
- Returns the token parser instances to add to the existing list.
- renderDescription() : string
- renderExpression() : string
- renderRoute() : array<string|int, string>|string
- sort() : ArrayIterator<string|int, Descriptor>
- sortByVisibility() : ArrayIterator<string|int, Descriptor>
- contextRouteRenderer() : LinkRenderer
Properties
$documentationSet read-only
private
DocumentationSetDescriptor
$documentationSet
$markdownConverter read-only
private
ConverterInterface
$markdownConverter
$pathBuilder read-only
private
PathBuilder
$pathBuilder
$project read-only
private
ProjectDescriptor
$project
$relativePathToRootConverter read-only
private
RelativePathToRootConverter
$relativePathToRootConverter
$routeRenderer
private
LinkRenderer
$routeRenderer
Methods
__construct()
Registers the structure and transformation with this extension.
public
__construct(ProjectDescriptor $project, DocumentationSetDescriptor $documentationSet, ConverterInterface $markdownConverter, LinkRenderer $routeRenderer, RelativePathToRootConverter $relativePathToRootConverter, PathBuilder $pathBuilder) : mixed
Parameters
- $project : ProjectDescriptor
-
Represents the complete Abstract Syntax Tree.
- $documentationSet : DocumentationSetDescriptor
- $markdownConverter : ConverterInterface
- $routeRenderer : LinkRenderer
- $relativePathToRootConverter : RelativePathToRootConverter
- $pathBuilder : PathBuilder
getExpressionParsers()
public
getExpressionParsers() : array<string|int, mixed>
Return values
array<string|int, mixed>getFilters()
Returns a list of all filters that are exposed by this extension.
public
getFilters() : array<string|int, TwigFilter>
Return values
array<string|int, TwigFilter>getFunctions()
Returns a listing of all functions that this extension adds.
public
getFunctions() : array<string|int, TwigFunction>
This method is automatically used by Twig upon registering this extension (which is done automatically by phpDocumentor) to determine an additional list of functions.
See the Class' DocBlock for a listing of functionality added by this Extension.
Return values
array<string|int, TwigFunction>getGlobals()
Initialize series of globals used by the writers to set the context
public
getGlobals() : Descriptor, usesNamespaces: bool, usesPackages: bool, destinationPath: ?string, parameter: array, env: mixed}
Return values
Descriptor, usesNamespaces: bool, usesPackages: bool, destinationPath: ?string, parameter: arraygetLastModified()
Returns the last modification time of the extension for cache invalidation.
public
getLastModified() : int
This timestamp should be the last time the source code of the extension class and all its dependencies were modified (including the Runtime class).
Return values
intgetNodeVisitors()
Returns the node visitor instances to add to the existing list.
public
getNodeVisitors() : array<string|int, NodeVisitorInterface>
Return values
array<string|int, NodeVisitorInterface>getOperators()
Returns a list of operators to add to the existing list.
public
getOperators() : array<string|int, array<string|int, mixed>>
Return values
array<string|int, array<string|int, mixed>>getTests()
Returns a list of tests to add to the existing list.
public
getTests() : array<int, TwigTest>
Return values
array<int, TwigTest>getTokenParsers()
Returns the token parser instances to add to the existing list.
public
getTokenParsers() : array<string|int, TokenParserInterface>
Return values
array<string|int, TokenParserInterface>renderDescription()
public
renderDescription(array<string|int, mixed> $context, DescriptionDescriptor|null $description) : string
Parameters
- $context : array<string|int, mixed>
- $description : DescriptionDescriptor|null
Return values
stringrenderExpression()
public
renderExpression(array<string|int, mixed> $context, Expression|null $expression) : string
Parameters
- $context : array<string|int, mixed>
- $expression : Expression|null
Return values
stringrenderRoute()
public
renderRoute(array<string|int, mixed> $context, array<string|int, Type>|Type|DescriptorAbstract|Fqsen|Reference|Path|string|iterable<string|int, mixed> $value, string $presentation) : array<string|int, string>|string
Parameters
- $context : array<string|int, mixed>
- $value : array<string|int, Type>|Type|DescriptorAbstract|Fqsen|Reference|Path|string|iterable<string|int, mixed>
- $presentation : string
Return values
array<string|int, string>|stringsort()
public
sort(string $direction, Collection<string|int, Descriptor> $collection) : ArrayIterator<string|int, Descriptor>
Parameters
- $direction : string
- $collection : Collection<string|int, Descriptor>
Return values
ArrayIterator<string|int, Descriptor>sortByVisibility()
public
sortByVisibility(Collection<string|int, Descriptor> $collection) : ArrayIterator<string|int, Descriptor>
Parameters
- $collection : Collection<string|int, Descriptor>
Return values
ArrayIterator<string|int, Descriptor>contextRouteRenderer()
private
contextRouteRenderer(array<string|int, mixed> $context) : LinkRenderer
Parameters
- $context : array<string|int, mixed>