\phpDocumentor\Transformer\Writer\TwigExtension

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

Summary

Methods
Properties
Constants
__construct()
getGlobals()
getTests()
getFunctions()
getFilters()
renderDescription()
renderRoute()
sort()
sortByVisibility()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
contextRouteRenderer()
$routeRenderer
$markdownConverter
$relativePathToRootConverter
$pathBuilder
$documentationSet
$project
N/A

Properties

$routeRenderer

$routeRenderer : \phpDocumentor\Transformer\Writer\Twig\LinkRenderer

Type

\phpDocumentor\Transformer\Writer\Twig\LinkRenderer

$markdownConverter

$markdownConverter : \League\CommonMark\ConverterInterface

Type

\League\CommonMark\ConverterInterface

$relativePathToRootConverter

$relativePathToRootConverter : \phpDocumentor\Transformer\Writer\Twig\RelativePathToRootConverter

Type

\phpDocumentor\Transformer\Writer\Twig\RelativePathToRootConverter

$pathBuilder

$pathBuilder : \phpDocumentor\Transformer\Writer\Twig\PathBuilder

Type

\phpDocumentor\Transformer\Writer\Twig\PathBuilder

$documentationSet

$documentationSet : \phpDocumentor\Descriptor\DocumentationSetDescriptor

Type

\phpDocumentor\Descriptor\DocumentationSetDescriptor

$project

$project : \phpDocumentor\Descriptor\ProjectDescriptor

Type

\phpDocumentor\Descriptor\ProjectDescriptor

Methods

__construct()

__construct(\phpDocumentor\Descriptor\ProjectDescriptor  $project, \phpDocumentor\Descriptor\DocumentationSetDescriptor  $documentationSet, \League\CommonMark\ConverterInterface  $markdownConverter, \phpDocumentor\Transformer\Writer\Twig\LinkRenderer  $routeRenderer, \phpDocumentor\Transformer\Writer\Twig\RelativePathToRootConverter  $relativePathToRootConverter, \phpDocumentor\Transformer\Writer\Twig\PathBuilder  $pathBuilder) : mixed

Registers the structure and transformation with this extension.

Parameters

\phpDocumentor\Descriptor\ProjectDescriptor $project

Represents the complete Abstract Syntax Tree.

\phpDocumentor\Descriptor\DocumentationSetDescriptor $documentationSet
\League\CommonMark\ConverterInterface $markdownConverter
\phpDocumentor\Transformer\Writer\Twig\LinkRenderer $routeRenderer
\phpDocumentor\Transformer\Writer\Twig\RelativePathToRootConverter $relativePathToRootConverter
\phpDocumentor\Transformer\Writer\Twig\PathBuilder $pathBuilder

Returns

mixed —

getGlobals()

getGlobals() : array{project: \phpDocumentor\Descriptor\ProjectDescriptor, documentationSet: \phpDocumentor\Descriptor\DocumentationSetDescriptor, node: ?\phpDocumentor\Descriptor\Descriptor, usesNamespaces: bool, usesPackages: bool, destinationPath: ?string, parameter: array<string,mixed>, env: mixed}

Initialize series of globals used by the writers to set the context

Returns

array{project: \phpDocumentor\Descriptor\ProjectDescriptor, documentationSet: \phpDocumentor\Descriptor\DocumentationSetDescriptor, node: ?\phpDocumentor\Descriptor\Descriptor, usesNamespaces: bool, usesPackages: bool, destinationPath: ?string, parameter: array, env: mixed} —

getTests()

getTests() : list<\Twig\TwigTest>

Returns

list<\Twig\TwigTest> —

getFunctions()

getFunctions() : \Twig\TwigFunction[]

Returns a listing of all functions that this extension adds.

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.

Returns

\Twig\TwigFunction[] —

getFilters()

getFilters() : \Twig\TwigFilter[]

Returns a list of all filters that are exposed by this extension.

Returns

\Twig\TwigFilter[] —

renderDescription()

renderDescription(array  $context, ?\phpDocumentor\Descriptor\DocBlock\DescriptionDescriptor  $description) : string

Parameters

array $context
?\phpDocumentor\Descriptor\DocBlock\DescriptionDescriptor $description

Returns

string —

renderRoute()

renderRoute(array  $context, \phpDocumentor\Reflection\Type[]|\phpDocumentor\Reflection\Type|\phpDocumentor\Descriptor\DescriptorAbstract|\phpDocumentor\Reflection\Fqsen|\phpDocumentor\Reflection\DocBlock\Tags\Reference\Reference|\phpDocumentor\Path|string|iterable  $value, string  $presentation) : string[]|string

Parameters

array $context
\phpDocumentor\Reflection\Type[]|\phpDocumentor\Reflection\Type|\phpDocumentor\Descriptor\DescriptorAbstract|\phpDocumentor\Reflection\Fqsen|\phpDocumentor\Reflection\DocBlock\Tags\Reference\Reference|\phpDocumentor\Path|string|iterable $value
string $presentation

Returns

string[]|string —

sort()

sort(string  $direction, \phpDocumentor\Descriptor\Collection<\phpDocumentor\Descriptor\Descriptor>  $collection) : \ArrayIterator<array-key,\phpDocumentor\Descriptor\Descriptor>

Parameters

string $direction
\phpDocumentor\Descriptor\Collection<\phpDocumentor\Descriptor\Descriptor> $collection

Returns

\ArrayIterator

sortByVisibility()

sortByVisibility(\phpDocumentor\Descriptor\Collection<\phpDocumentor\Descriptor\Descriptor>  $collection) : \ArrayIterator<array-key,\phpDocumentor\Descriptor\Descriptor>

Parameters

\phpDocumentor\Descriptor\Collection<\phpDocumentor\Descriptor\Descriptor> $collection

Returns

\ArrayIterator

contextRouteRenderer()

contextRouteRenderer(array  $context) : \phpDocumentor\Transformer\Writer\Twig\LinkRenderer

Parameters

array $context

Returns

\phpDocumentor\Transformer\Writer\Twig\LinkRenderer —