final class MetadataWriter

Writes metadata as nested lists of "**key:** value" entries or plain values.

Scalars are written as JSON, except strings that are not themselves JSON text.

Methods§

public function write(mixed $data, int $indent = 0): string

Writes one level of metadata.

Parameters

$datamixedA mapping or a sequence
$indentintThe indentation of this level

Returns

string The Markdown list, or {} or [] when empty

Throws

InvalidInputException When a sequence is not a list
JsonException When a scalar cannot be encoded
Test cases 5
Called from 2
Calls 10

Test cases 8§

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 3

Relations§

Instantiated in 1
Method calls 1