Constants

PRESENTATION_NORMAL

PRESENTATION_NORMAL = 'normal'

PRESENTATION_URL

PRESENTATION_URL = 'url'

PRESENTATION_CLASS_SHORT

PRESENTATION_CLASS_SHORT = 'class:short'

PRESENTATION_FILE_SHORT

PRESENTATION_FILE_SHORT = 'file:short'

Properties

$destination

$destination : string

Type

string

$router

$router : \phpDocumentor\Transformer\Router\Router

Type

Router

$convertToRootPath

$convertToRootPath : bool

Type

bool

Methods

__construct()

__construct(\phpDocumentor\Transformer\Router\Router  $router) : mixed

Parameters

\phpDocumentor\Transformer\Router\Router $router

Returns

mixed —

setDestination()

setDestination(string  $destination) : void

Parameters

string $destination

withDestination()

withDestination(string  $destination) : self

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

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

string $destination

Returns

self —

withProject()

withProject(\phpDocumentor\Descriptor\ProjectDescriptor  $projectDescriptor) : self

Parameters

\phpDocumentor\Descriptor\ProjectDescriptor $projectDescriptor

Returns

self —

doNotConvertUrlsToRootPath()

doNotConvertUrlsToRootPath() : self

Returns

self —

getDestination()

getDestination() : string

Returns the target directory relative to the Project's Root.

Returns

string —

link()

link(\phpDocumentor\Descriptor\Descriptor|\phpDocumentor\Reflection\Fqsen|\League\Uri\Uri  $value) : string

Parameters

\phpDocumentor\Descriptor\Descriptor|\phpDocumentor\Reflection\Fqsen|\League\Uri\Uri $value

Returns

string —

render()

render(\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

\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 —

convertToRootPath()

convertToRootPath(string  $pathOrReference, bool  $force = false) : ?string

Converts the given path to be relative to the root of the documentation target directory.

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

string $pathOrReference
bool $force

Returns

?string —

renderASeriesOfLinks()

renderASeriesOfLinks(iterable  $value, string  $presentation) : \phpDocumentor\Transformer\Writer\Twig\list<string>

Returns a series of anchors and strings for the given collection of routable items.

Parameters

iterable $value
string $presentation

Returns

\phpDocumentor\Transformer\Writer\Twig\list

renderLink()

renderLink(string|\phpDocumentor\Path|\phpDocumentor\Reflection\Type|\phpDocumentor\Descriptor\DescriptorAbstract|\phpDocumentor\Reflection\Fqsen|\phpDocumentor\Reflection\DocBlock\Tags\Reference\Fqsen  $node, string  $presentation) : string

Parameters

string|\phpDocumentor\Path|\phpDocumentor\Reflection\Type|\phpDocumentor\Descriptor\DescriptorAbstract|\phpDocumentor\Reflection\Fqsen|\phpDocumentor\Reflection\DocBlock\Tags\Reference\Fqsen $node
string $presentation

Returns

string —

renderType()

renderType(iterable<\phpDocumentor\Reflection\Type>  $value) : \phpDocumentor\Transformer\Writer\Twig\list<string>

Parameters

iterable<\phpDocumentor\Reflection\Type> $value

Returns

\phpDocumentor\Transformer\Writer\Twig\list

getPathPrefixBasedOnDepth()

getPathPrefixBasedOnDepth() : string

Calculates how deep the given destination is and returns a prefix.

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.

Returns

string —

isReferenceToFqsen()

isReferenceToFqsen(string  $path) : bool

Parameters

string $path

Returns

bool —

withoutLeadingSlash()

withoutLeadingSlash(string  $path) : string

Parameters

string $path

Returns

string —

createFqsenFromReference()

createFqsenFromReference(string  $path) : \phpDocumentor\Reflection\Fqsen

Parameters

string $path

Returns

\phpDocumentor\Reflection\Fqsen —

renderAbstractListLinks()

renderAbstractListLinks(\phpDocumentor\Reflection\Types\AbstractList  $node, string  $presentation) : string

Parameters

\phpDocumentor\Reflection\Types\AbstractList $node
string $presentation

Returns

string —