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

NameValueDescriptionDefined In
SYMBOL_INTERSECTION'&'BeastBytes\CodPhp\Writer\Markdown\Helpers
SYMBOL_REFERENCE'&'BeastBytes\CodPhp\Writer\Markdown\Helpers
SYMBOL_UNION'|'BeastBytes\CodPhp\Writer\Markdown\Helpers
SYMBOL_VARIADIC'...'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


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): string
$elementBeastBytes\CodPhp\Element\ObjectElementCurrent element.
$propertystringProperty to list.
returnstringList of items.

Declared in BeastBytes\CodPhp\Writer\Markdown\Helpers


toKebabCase()

Converts a camelCased or PascalCased string to a kebab-cased string, e.g. CodPhp becomes cod-php.

public static function toKebabCase(string $string): string
$stringstring`camelCased` or `PascalCased` 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