abstract class Writer
Base Writer class that provides properties and methods common to all concrete Writer classes.
| Namespace | BeastBytes\CodPhp\Writer |
|---|---|
| Inheritance | BeastBytes\CodPhp\Writer\Writer |
| Implements | |
| Subclasses | BeastBytes\CodPhp\Writer\Markdown\VitePress\Writer |
Properties
$outputDir
Base output directory for rendered templates.
| Type | Read/Write | Default |
|---|---|---|
| string | Write |
Declared in BeastBytes\CodPhp\Writer\Writer
$templateDir
| Type | Read/Write | Default |
|---|---|---|
| string | Read/Write |
Declared in BeastBytes\CodPhp\Writer\Writer
$templateRenderer
Template renderer
| Type | Read/Write | Default |
|---|---|---|
| BeastBytes\CodPhp\Renderer\TemplateRendererInterface | Write |
Declared in BeastBytes\CodPhp\Writer\Writer
Methods
render()
Render a template and return the result.
| public function render(string $template, array $parameters = []): string | ||
| $template | string | Template to render. |
| $parameters | array | Template parameters. |
| return | string | |
| throws | Throwable | |
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 | ||
| $element | BeastBytes\CodPhp\Element\ObjectElement | Element to render. |
| $parameters | array | Template parameters. |
| return | void | |
| throws | Throwable | |
Declared in BeastBytes\CodPhp\Writer\Writer
writeIndex()
Write the API index file.
| public function writeIndex(array $elements, array $parameters): void | ||
| $elements | array | Namespace elements. |
| $parameters | array | Template parameters. |
| return | void | |
| throws | Throwable | |
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 | ||
| $elements | array | Namespace elements. |
| $parameters | array | Template parameters. |
| return | void | |
Declared in BeastBytes\CodPhp\Writer\Writer
Generated by CodPhp