final class CardReader

Reads the item cards of a Markdown definition body.

A card is an ATX "# ID" heading followed by badge rows, one statement paragraph, evidence quotations and bold field sections, in that order.

Methods§

public function __construct(private Presentation $presentation, private Citation|null $source)

Parameters

$presentationPresentationReceives the badges, citations and links of each card
$sourceCitation|nullResolves citations against the definition's source
public function cards(Document $document, string $body, string $file): list<stdClass>

Reads every card of a document.

Parameters

$documentDocumentThe parsed body
$bodystringThe body text, used to check the heading syntax
$filestringThe definition file

Returns

list<stdClass> The items

Throws

InvalidInputException When a heading is not written as "# ID" or a card is malformed
Test cases 5
Called from 1
Calls 5
public function card(Heading $heading, list<Node> $blocks, string $file): stdClass

Reads one card.

Parameters

$headingHeadingThe heading holding the item ID
$blockslist<Node>The blocks up to the next heading
$filestringThe definition file

Returns

stdClass The item

Throws

InvalidInputException When the card lacks a statement or a badge, quotation or field is malformed
Test cases 4
Called from 2
Calls 13

Private surface 2§

Implementation details, listed for orientation only.

private Presentation $presentation
private Citation|null $source

Test cases 15§

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

Dedicated tests 9
Other tests reaching this symbol 6

Relations§

Instantiated in 1
Method calls 1