Constants
PRESENTATION_NORMAL Line 47
mixed PRESENTATION_NORMAL = 'normal'
PRESENTATION_URL Line 48
mixed PRESENTATION_URL = 'url'
PRESENTATION_CLASS_SHORT Line 49
mixed PRESENTATION_CLASS_SHORT = 'class:short'
PRESENTATION_FILE_SHORT Line 50
mixed PRESENTATION_FILE_SHORT = 'file:short'
Properties
$destination Line 53
private$destination : string
$router Line 56
private$router : \phpDocumentor\Transformer\Router\Router
$project Line 59
private$project : \phpDocumentor\Descriptor\ProjectDescriptor|null
Methods
__construct() Line 61
public__construct(Router $router) : mixed
setDestination() Line 69
publicsetDestination(string $destination) : void
Parameters
withDestination() Line 84
Sets the destination directory relative to the Project's Root.
publicwithDestination(string $destination) : self
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.
For this specific extension the destination is provided in the Twig writer itself.
Parameters
Returns
self —
withProject() Line 92
publicwithProject(ProjectDescriptor $projectDescriptor) : self
getDestination() Line 103
Returns the target directory relative to the Project's Root.
publicgetDestination() : string
Returns
string —
link() Line 111
publiclink(Descriptor|Fqsen|Uri $value) : string
render() Line 126
publicrender(\phpDocumentor\Reflection\Type[]|Type|Descriptor|Fqsen|Path|string|iterable $value, string $presentation) : string[]|string
Parameters
Returns
string[]|string —
convertToRootPath() Line 175
Converts the given path to be relative to the root of the documentation target directory.
publicconvertToRootPath(string $pathOrReference) : string|null
It is not possible to use absolute paths in documentation templates since they may be used locally, or in a subfolder. As such we need to calculate the number of levels to go up from the current document's directory and then append the given path.
For example:
Suppose you are in <root>/classes/my/class.html and you want open
<root>/my/index.html then you provide 'my/index.html' to this method
and it will convert it into ../../my/index.html (<root>/classes/my is
two nesting levels until the root).
This method does not try to normalize or optimize the paths in order to save on development time and performance, and because it adds no real value.
In addition, when a path starts with an @-sign, it is interpreted as a reference to a structural element and we use the router to try and find a path to which this refers.
Parameters
Returns
string|null —
renderASeriesOfLinks() Line 199
Returns a series of anchors and strings for the given collection of routable items.
privaterenderASeriesOfLinks(iterable $value, string $presentation) : list
Parameters
Returns
list —
renderLink() Line 212
privaterenderLink(string|Path|Object_|Descriptor|Fqsen $node, string $presentation) : string
renderType() Line 306
privaterenderType(iterable $value) : list
Parameters
Returns
list —
getPathPrefixBasedOnDepth() Line 325
Calculates how deep the given destination is and returns a prefix.
privategetPathPrefixBasedOnDepth() : string
The calculated prefix is used to get back to the root (i.e. three levels deep means ../../..
) or an empty
string is returned when you are already at the same level as the root.
This prefix will include a trailing forward slash (/) when it actually needs to direct the caller to go elsewhere.