final class CardWriter

Writes a definition as Markdown cards in the canonical layout.

Each card has its badges, statement, evidence quotations and then its fields in a fixed order; badge images, link targets and citations read from the original are reused.

Methods§

public function render(
    stdClass $data,
    array<string, array<string, array<string, string>>> $links,
    array<string, array<string, array<string, array{url: string, title: ?string}>>> $badges,
    array<string, list<array{url: string, label: string}|null>> $citations = [],
    Citation|null $source = null,
): string

Writes a definition.

Parameters

$datastdClassThe definition
$linksarray<string, array<string, array<string, string>>>Link targets by item ID, field and linked ID
$badgesarray<string, array<string, array<string, array{url: string, title: ?string}>>>Badge images by item ID, field and value
$citationsarray<string, list<array{url: string, label: string}|null>>Citation links by item ID
$sourceCitation|nullCreates citation links for the definition's source

Returns

string The Markdown text

Throws

InvalidInputException When a record cannot be written as a card
JsonException When a metadata value cannot be encoded
Test cases 5
Called from 1
Calls 13

Test cases 7§

Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.

Dedicated tests 5
Other tests reaching this symbol 2

Relations§

Instantiated in 1
Method calls 1