Skip to content

DocsGenerator

Turns the documentation model into the full set of pages, plus the manifest that describes it.

Nothing here touches the filesystem: the command decides what to do with the artifacts, so a drift check can compare them against disk without writing, and a test can assert on them without a temporary directory.

final class DocsGenerator

SourceDocsGenerator.php
ConstantValueDescription
MANIFEST_FILE'.manifest.json'

public function __construct(Markdown $markdown = new Markdown(…), string $basePath = '/api'): mixed

ParameterTypeDescription
$markdownMarkdown
$basePathstring

Returns mixed

MethodDescription
generate(ApiIndex $index): array<string, EmittedArtifact>Every page the reference consists of, keyed by its path below the output directory.
getDiagnostics(): list<Diagnostic>
[`readManifest(string $outputDir): array<string, string>null`](#readmanifest)

public function generate(ApiIndex $index): array<string, EmittedArtifact>

Every page the reference consists of, keyed by its path below the output directory.

ParameterTypeDescription
$indexApiIndex

Returns array``<``string``, EmittedArtifact>

public function getDiagnostics(): list<Diagnostic>

Returns list``<Diagnostic>

public function readManifest(string $outputDir): array<string, string>|null

Reads a manifest previously written to $outputDir.

ParameterTypeDescription
$outputDirstring

Returns array``<``string``, ``string``>``|``null — Target path => checksum, or null when there is none.