classFieldWriter
final class FieldWriter
Writes the value of one bold field section of a card.
Prose is escaped text, metadata a nested list, and list fields bullet lists or "None." when empty.
Methods§
public function write(string $name, mixed $value, array<string, string> $links): stringWrites a field value.
Parameters
$name | string | The field name |
$value | mixed | The value in the shape of the YAML field |
$links | array<string, string> | Link targets read for this field by linked ID |
Returns
string The Markdown section bodyThrows
InvalidInputException When the value cannot be written for that fieldJsonException When a metadata value cannot be encodedTest cases 5
FieldWriterTest::testWriteRejectsARecordOfAnotherFieldcallsFieldWriterTest::testWriteRejectsAStringEntryOutsideTheReferenceFieldscallsFieldWriterTest::testWriteRejectsATestWithoutATargetcallsFieldWriterTest::testWriteRejectsAValueThatIsNotAListcallsFieldWriterTest::testWriteWritesTheSectionBodycalls
Called from 1
Calls 13
- function-call
is_stringline 34 - static-call Nodes::escape() line 35
- function-call
rtrimline 38 - method-call MetadataWriter::write() line 38
- new MetadataWriter line 38
- static-call Fields::sequence() line 41
- function-call
in_arrayline 42 - static-call Nodes::destination() line 43
- static-call Nodes::anchor() line 43
- static-call Record::fields() line 45
- static-call Fields::text() line 47
- new InvalidInputException line 55
- function-call
implodeline 59
Test cases 8§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 5
FieldWriterTest::testWriteRejectsARecordOfAnotherFieldcallsFieldWriterTest::testWriteRejectsAStringEntryOutsideTheReferenceFieldscallsFieldWriterTest::testWriteRejectsATestWithoutATargetcallsFieldWriterTest::testWriteRejectsAValueThatIsNotAListcallsFieldWriterTest::testWriteWritesTheSectionBodycalls
Other tests reaching this symbol 3
CardWriterTestcallsMarkdownDocumentTestcallsFormatterTestcalls