Skip to content

final class Helpers ​

Source Code

Static helper functions for the writer.

NamespaceBeastBytes\CodPhp\Writer\Markdown
Inheritance

BeastBytes\CodPhp\Writer\Markdown\Helpers

Constants ​

SYMBOL_INTERSECTION ​

string SYMBOL_INTERSECTION = '&'

Declared in BeastBytes\CodPhp\Writer\Markdown\Helpers

SYMBOL_REFERENCE ​

string SYMBOL_REFERENCE = '&'

Declared in BeastBytes\CodPhp\Writer\Markdown\Helpers

SYMBOL_UNION ​

string SYMBOL_UNION = '|'

Declared in BeastBytes\CodPhp\Writer\Markdown\Helpers

SYMBOL_VARIADIC ​

string SYMBOL_VARIADIC = '...'

Declared in BeastBytes\CodPhp\Writer\Markdown\Helpers

Methods ​

a() ​

Generates an HTML <a/> tag.

public static function a(string $content, string $href, array $attributes = []): string
$contentstringLink content
$hrefstringLink URL
$attributesarrayHTML attributes
returnstring

Declared in BeastBytes\CodPhp\Writer\Markdown\Helpers


deprecationNotice() ​

Generate a formatted deprecation message.

public static function deprecationNotice(BeastBytes\CodPhp\Element\Element $element): string
$elementBeastBytes\CodPhp\Element\ElementCurrent element.
returnstringDeprecation message.

Declared in BeastBytes\CodPhp\Writer\Markdown\Helpers


error() ​

Generate a formatted error message.

No message is created if the error level is below $minErrorLevel.

public static function error(BeastBytes\CodPhp\Error\Error $error, BeastBytes\CodPhp\Error\ErrorLevel $minErrorLevel): string
$errorBeastBytes\CodPhp\Error\ErrorError.
$minErrorLevelBeastBytes\CodPhp\Error\ErrorLevelMinimum error level.
returnstringError message.

Declared in BeastBytes\CodPhp\Writer\Markdown\Helpers


linkElements() ​

Generates a Markdown link between two elements or a FQCN to an element.

public static function linkElements(BeastBytes\CodPhp\Element\ObjectElement|string $from, BeastBytes\CodPhp\Element\ObjectElement $to): string
$fromBeastBytes\CodPhp\Element\ObjectElement|stringStart element or FQCN
$toBeastBytes\CodPhp\Element\ObjectElementDestination element
returnstringMarkdown link

Declared in BeastBytes\CodPhp\Writer\Markdown\Helpers


Generates a list of links.

public static function linkList(array $links, BeastBytes\CodPhp\Element\Element $element): string
$linksarrayLinks to list
$elementBeastBytes\CodPhp\Element\Element
returnstringList of links

Declared in BeastBytes\CodPhp\Writer\Markdown\Helpers


modifiers() ​

Returns formatted visibility and object modifiers.

public static function modifiers(BeastBytes\CodPhp\Element\ClassElement|BeastBytes\CodPhp\Element\MethodElement $element, bool $capitalise = false): string
$elementBeastBytes\CodPhp\Element\ClassElement|BeastBytes\CodPhp\Element\MethodElement
$capitalisebool
returnstringFormatted modifiers

Declared in BeastBytes\CodPhp\Writer\Markdown\Helpers


parameters() ​

Returns the parameters for a method declaration.

public static function parameters(BeastBytes\CodPhp\Element\MethodElement $method, BeastBytes\CodPhp\Element\ObjectElement $element, BeastBytes\CodPhp\Type\Language $language): string
$methodBeastBytes\CodPhp\Element\MethodElementThe method.
$elementBeastBytes\CodPhp\Element\ObjectElementMethod parent element.
$languageBeastBytes\CodPhp\Type\LanguagePHP Manual language.
returnstringMethod declaration parameters
throwsReflectionException

Declared in BeastBytes\CodPhp\Writer\Markdown\Helpers


sanitise() ​

Sanitise a string for HTML, and optionally in a Markdown table.

This function also resolves inline @link tags.

public static function sanitise(string $string, bool $mdt = false): string
$stringstringThe string to sanitise.
$mdtboolWhether to additionally sanitise for use in a Markdown table
returnstringSanitised string

Declared in BeastBytes\CodPhp\Writer\Markdown\Helpers


Generate a link to object element source code;

public static function sourceLink(string $baseUrl, BeastBytes\CodPhp\Element\ObjectElement $element): string
$baseUrlstringSource code base URL
$elementBeastBytes\CodPhp\Element\ObjectElementElement to link to source
returnstring

Declared in BeastBytes\CodPhp\Writer\Markdown\Helpers


tdList() ​

Generate a list for inclusion in a <td/> with items linked from the current element.

public static function tdList(BeastBytes\CodPhp\Element\ObjectElement $element, string $property, BeastBytes\CodPhp\Type\Language|null $language = null): string
$elementBeastBytes\CodPhp\Element\ObjectElementCurrent element.
$propertystringProperty to list.
$languageBeastBytes\CodPhp\Type\Language|nullPHP Manual language.
returnstringList of items.

Declared in BeastBytes\CodPhp\Writer\Markdown\Helpers


toKebabCase() ​

Converts a camelCased, PascalCased, or SCREAMING_SNAKE_CASE string to a kebab-cased string, e.g.codPhp, CodPhp, or COD_PHP all become cod-php.

Used to convert types and constant names to links.

public static function toKebabCase(string $string): string
$stringstring`camelCased`, `PascalCased`, or `SCREAMING_SNAKE_CASE` string.
returnstring`kebab-cased` string.

Declared in BeastBytes\CodPhp\Writer\Markdown\Helpers


toWords() ​

Converts a string to space-separated words, e.g. CodPhp becomes Cod Php.

public static function toWords(string $string): string
$stringstringString to convert.
returnstringConverted string.

Declared in BeastBytes\CodPhp\Writer\Markdown\Helpers


type() ​

Returns a string representation of a ReflectionType with a link to the type documentation.

Only PHP (including extensions) and intra-package types are linked; external packages are not.

public static function type(phpDocumentor\Reflection\Type|ReflectionType $type, BeastBytes\CodPhp\Element\ObjectElement $element, BeastBytes\CodPhp\Type\Language $language): string
$typephpDocumentor\Reflection\Type|ReflectionTypeReflectionType to get a string representation of.
$elementBeastBytes\CodPhp\Element\ObjectElementElement containing the type.
$languageBeastBytes\CodPhp\Type\LanguagePHP Manual language.
returnstringString representation of the ReflectionType.
throwsReflectionException

Declared in BeastBytes\CodPhp\Writer\Markdown\Helpers


Generated by CodPhp