Skip to content

abstract class Writer ​

Source Code

Base Writer class that provides properties and methods common to all concrete Writer classes.

NamespaceBeastBytes\CodPhp\Writer
Inheritance

BeastBytes\CodPhp\Writer\Writer

Implements

BeastBytes\CodPhp\Writer\WriterInterface

Subclasses

BeastBytes\CodPhp\Writer\Markdown\VitePress\Writer
BeastBytes\CodPhp\Writer\Markdown\Writer

Properties ​

$outputDir ​

Base output directory for rendered templates.

TypeRead/WriteDefault
stringWrite

Declared in BeastBytes\CodPhp\Writer\Writer


$templateDir ​

TypeRead/WriteDefault
stringRead/Write

Declared in BeastBytes\CodPhp\Writer\Writer


$templateRenderer ​

Template renderer

TypeRead/WriteDefault
BeastBytes\CodPhp\Renderer\TemplateRendererInterfaceWrite

Declared in BeastBytes\CodPhp\Writer\Writer


Methods ​

render() ​

Render a template and return the result.

public function render(string $template, array $parameters = []): string
$templatestringTemplate to render.
$parametersarrayTemplate parameters.
returnstring
throwsThrowable

Declared in BeastBytes\CodPhp\Writer\Writer


writeElement() ​

Render an element and write the result to the output directory.

public function writeElement(BeastBytes\CodPhp\Element\ObjectElement $element, array $parameters): void
$elementBeastBytes\CodPhp\Element\ObjectElementElement to render.
$parametersarrayTemplate parameters.
returnvoid
throwsThrowable

Declared in BeastBytes\CodPhp\Writer\Writer


writeIndex() ​

Write the API index file.

public function writeIndex(array $elements, array $parameters): void
$elementsarrayNamespace elements.
$parametersarrayTemplate parameters.
returnvoid
throwsThrowable

Declared in BeastBytes\CodPhp\Writer\Writer


writeOther() ​

Called from the CodPhp command after writeIndex().

Override to generate any other required documents.

All rendered elements, indexed by their FQCN, are contained in the $elements property.

Call writeFile() to render a template. If the output file extension differs from the Writer's default, set the $extension parameter in the call.

public function writeOther(array $elements, array $parameters): void
$elementsarrayNamespace elements.
$parametersarrayTemplate parameters.
returnvoid

Declared in BeastBytes\CodPhp\Writer\Writer


Generated by CodPhp