Extension extends AbstractExtension implements ExtensionInterface, GlobalsInterface
FinalYes
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
Properties
- $documentationSet : DocumentationSetInterface
- $markdownConverter : ConverterInterface
- $metadataTemplateResolver : MetadataTemplateResolver|null
- $pathBuilder : PathBuilder
- $project : ProjectInterface
- $relativePathToRootConverter : RelativePathToRootConverter
- $routeRenderer : LinkRenderer
Methods
- __construct() : mixed
- Registers the structure and transformation with this extension.
- getFilters() : TwigFilter[]
- Returns a list of all filters that are exposed by this extension.
- getFunctions() : TwigFunction[]
- Returns a listing of all functions that this extension adds.
-
getGlobals()
: array{project: ProjectInterface, documentationSet: DocumentationSetInterface, node: ?Descriptor, usesNamespaces: bool, usesPackages: bool, destinationPath: ?string, parameter: array
, env: mixed} - Initialize series of globals used by the writers to set the context
- getTests() : array<int, TwigTest>
- renderDescription() : string
- renderExpression() : string
- renderRoute() : string[]|string
- sort() : ArrayIterator<string|int, Descriptor>
- sortByVisibility() : ArrayIterator<string|int, Descriptor>
- contextRouteRenderer() : LinkRenderer
Properties
$documentationSet read-only
private
DocumentationSetInterface
$documentationSet
$markdownConverter read-only
private
ConverterInterface
$markdownConverter
$metadataTemplateResolver read-only
private
MetadataTemplateResolver|null
$metadataTemplateResolver
= null
$pathBuilder read-only
private
PathBuilder
$pathBuilder
$project read-only
private
ProjectInterface
$project
$relativePathToRootConverter read-only
private
RelativePathToRootConverter
$relativePathToRootConverter
$routeRenderer
private
LinkRenderer
$routeRenderer
Methods
__construct()
Registers the structure and transformation with this extension.
public
__construct(ProjectInterface $project, DocumentationSetInterface $documentationSet, ConverterInterface $markdownConverter, LinkRenderer $routeRenderer, RelativePathToRootConverter $relativePathToRootConverter, PathBuilder $pathBuilder[, MetadataTemplateResolver|null $metadataTemplateResolver = null ]) : mixed
Parameters
- $project : ProjectInterface
-
Represents the complete Abstract Syntax Tree.
- $documentationSet : DocumentationSetInterface
- $markdownConverter : ConverterInterface
- $routeRenderer : LinkRenderer
- $relativePathToRootConverter : RelativePathToRootConverter
- $pathBuilder : PathBuilder
- $metadataTemplateResolver : MetadataTemplateResolver|null = null
getFilters()
Returns a list of all filters that are exposed by this extension.
public
getFilters() : TwigFilter[]
Return values
TwigFilter[]getFunctions()
Returns a listing of all functions that this extension adds.
public
getFunctions() : 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
TwigFunction[]getGlobals()
Initialize series of globals used by the writers to set the context
public
getGlobals() : array{project: ProjectInterface, documentationSet: DocumentationSetInterface, node: ?Descriptor, usesNamespaces: bool, usesPackages: bool, destinationPath: ?string, parameter: array, env: mixed}
Return values
array{project: ProjectInterface, documentationSet: DocumentationSetInterface, node: ?Descriptor, usesNamespaces: bool, usesPackages: bool, destinationPath: ?string, parameter: arraygetTests()
public
getTests() : array<int, TwigTest>
Return values
array<int, TwigTest>renderDescription()
public
renderDescription(array $context, DescriptionInterface|null $description) : string
Parameters
- $context : array
- $description : DescriptionInterface|null
Return values
stringrenderExpression()
public
renderExpression(array $context, Expression|null $expression) : string
Parameters
- $context : array
- $expression : Expression|null
Return values
stringrenderRoute()
public
renderRoute(array $context, Type[]|Type|Descriptor|Fqsen|Reference|Path|string|iterable<string|int, mixed> $value, string $presentation) : string[]|string
Parameters
- $context : array
- $value : Type[]|Type|Descriptor|Fqsen|Reference|Path|string|iterable<string|int, mixed>
- $presentation : string
Return values
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 $context) : LinkRenderer
Parameters
- $context : array