final class Helpers
Static helper functions for the writer.
| Namespace | BeastBytes\CodPhp\Writer\Markdown |
|---|---|
| Inheritance | BeastBytes\CodPhp\Writer\Markdown\Helpers |
Constants
| Name | Value | Description | Defined 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 | ||
| $content | string | Link content |
| $href | string | Link URL |
| $attributes | array | HTML attributes |
| return | string | |
Declared in BeastBytes\CodPhp\Writer\Markdown\Helpers
deprecationNotice()
Generate a formatted deprecation message.
| public static function deprecationNotice(BeastBytes\CodPhp\Element\Element $element): string | ||
| $element | BeastBytes\CodPhp\Element\Element | Current element. |
| return | string | Deprecation 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 | ||
| $error | BeastBytes\CodPhp\Error\Error | Error. |
| $minErrorLevel | BeastBytes\CodPhp\Error\ErrorLevel | Minimum error level. |
| return | string | Error 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 | ||
| $from | BeastBytes\CodPhp\Element\ObjectElement|string | Start element or FQCN |
| $to | BeastBytes\CodPhp\Element\ObjectElement | Destination element |
| return | string | Markdown link |
Declared in BeastBytes\CodPhp\Writer\Markdown\Helpers
linkList()
Generates a list of links.
| public static function linkList(array $links, BeastBytes\CodPhp\Element\Element $element): string | ||
| $links | array | Links to list |
| $element | BeastBytes\CodPhp\Element\Element | |
| return | string | List 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 | ||
| $element | BeastBytes\CodPhp\Element\ClassElement|BeastBytes\CodPhp\Element\MethodElement | |
| $capitalise | bool | |
| return | string | Formatted 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 | ||
| $method | BeastBytes\CodPhp\Element\MethodElement | The method. |
| $element | BeastBytes\CodPhp\Element\ObjectElement | Method parent element. |
| $language | BeastBytes\CodPhp\Type\Language | PHP Manual language. |
| return | string | Method declaration parameters |
| throws | ReflectionException | |
Declared in BeastBytes\CodPhp\Writer\Markdown\Helpers
sourceLink()
Generate a link to object element source code;
| public static function sourceLink(string $baseUrl, BeastBytes\CodPhp\Element\ObjectElement $element): string | ||
| $baseUrl | string | Source code base URL |
| $element | BeastBytes\CodPhp\Element\ObjectElement | Element to link to source |
| return | string | |
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 | ||
| $element | BeastBytes\CodPhp\Element\ObjectElement | Current element. |
| $property | string | Property to list. |
| return | string | List 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 | ||
| $string | string | `camelCased` or `PascalCased` string. |
| return | string | `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 | ||
| $string | string | String to convert. |
| return | string | Converted 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 | ||
| $type | phpDocumentor\Reflection\Type|ReflectionType | ReflectionType to get a string representation of. |
| $element | BeastBytes\CodPhp\Element\ObjectElement | Element containing the type. |
| $language | BeastBytes\CodPhp\Type\Language | PHP Manual language. |
| return | string | String representation of the ReflectionType. |
| throws | ReflectionException | |
Declared in BeastBytes\CodPhp\Writer\Markdown\Helpers
Generated by CodPhp