phpDocumentor

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

Interfaces, Classes and Traits

ExtensionInterface
An interface shared by all Twig interfaces intended for phpDocumentor.
GlobalsInterface

Table of Contents

$data  : ProjectDescriptor
$markdownConverter  : MarkdownConverterInterface
$routeRenderer  : LinkRenderer
__construct()  : mixed
Registers the structure and transformation with this extension.
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()  : array<string, \phpDocumentor\Descriptor\ProjectDescriptor|bool>
Returns an array of global variables to inject into a Twig template.
setDestination()  : void
Sets the destination directory relative to the Project's Root.

Properties

$markdownConverter

private MarkdownConverterInterface $markdownConverter

Methods

__construct()

Registers the structure and transformation with this extension.

public __construct(ProjectDescriptor $project, MarkdownConverterInterface $markdownConverter, LinkRenderer $routeRenderer) : mixed
Parameters
$project : ProjectDescriptor

Represents the complete Abstract Syntax Tree.

$markdownConverter : MarkdownConverterInterface
$routeRenderer : LinkRenderer
Return values
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()

Returns an array of global variables to inject into a Twig template.

public getGlobals() : array<string, \phpDocumentor\Descriptor\ProjectDescriptor|bool>
Return values
array<string, \phpDocumentor\Descriptor\ProjectDescriptor|bool>

setDestination()

Sets the destination directory relative to the Project's Root.

public setDestination(string $destination) : void

The destination is the target directory containing the resulting file. This destination is relative to the Project's root and can be used for the calculation of nesting depths, etc.

Parameters
$destination : string
Tags
see
EnvironmentFactory

for the invocation of this method.

Return values
void

Search results