php-dextrin

Conformance
in package

FinalYes

This implementation's answers to the Dextrin Conformance Suite.

The suite runs every DXN implementation against the same cases, reaching each through its conformance command (dextrin conformance REQUEST ANSWER here) with a JSON request, and reading a JSON answer:

{"cases":   [{"id": "scalars: an integer", "operation": "decode", "text": "42"}]}
{"results": [{"id": "scalars: an integer", "canonical": "42"}]}

decode reads text and answers its canonical form (DXN.md §1.5); decode-binary reads binary, a base64 .dxnb document, and answers its canonical form; encode reads text and answers the exact bytes as base64. A case may carry schemas, .dxns sources compiled in order into the registry it runs with, and strict: true, which decodes strictly (DXNS.md §7). format reads text as a document and answers it laid out, comments kept, as text; edit reads text as a document, makes its edits in order -- replace, delete, insert, update, their path, value and where written as DXN text -- and answers the document rendered, as text; a refused edit answers document/<reason>. media-type answers the form media-type names (DXN.md §6) as form -- text, binary, schema or none; identify whether text is worth decoding as its form, text or schema, and identify-binary whether binary, base64, is a .dxnb document, each as identified: true or false. Any of them may answer error instead: the error's category (DXN.md §5), never its message. An error with no category yet is uncategorised, which no case expects, so it shows as a disagreement rather than passing by accident.

Table of Contents

Methods

answer()  : array{results: list>}
The answer to a decoded JSON request: one result per case, in order.
__construct()  : mixed
decodedBinary()  : array<string, string>
edited()  : Document
`$doc` after `$edits`, made in order; each one's path, value and where are DXN text, read by this implementation's own decoder.
identifiedBinary()  : array<string, string>
Whether `$base64` is a `.dxnb` document, or `binary` when it is not base64 at all.
loaded()  : Registry
A case's schemas, compiled in order into one registry.
outcome()  : array<string, string>
text()  : string
One of a case's text fields.
truth()  : string
Whether a body was identified, as the suite reads it.

Methods

answer()

The answer to a decoded JSON request: one result per case, in order.

public static answer(array{cases: list>} $request) : array{results: list>}
Parameters
$request : array{cases: list>}
Return values
array{results: list>}

decodedBinary()

private static decodedBinary(string $base64, Registry $registry, bool $strict) : array<string, string>
Parameters
$base64 : string
$registry : Registry
$strict : bool
Return values
array<string, string>

edited()

`$doc` after `$edits`, made in order; each one's path, value and where are DXN text, read by this implementation's own decoder.

private static edited(Document $doc, mixed $edits, Registry $registry) : Document
Parameters
$doc : Document
$edits : mixed
$registry : Registry
Return values
Document

identifiedBinary()

Whether `$base64` is a `.dxnb` document, or `binary` when it is not base64 at all.

private static identifiedBinary(string $base64) : array<string, string>
Parameters
$base64 : string
Return values
array<string, string>

loaded()

A case's schemas, compiled in order into one registry.

private static loaded(mixed $sources) : Registry
Parameters
$sources : mixed
Return values
Registry

outcome()

private static outcome(array<string, mixed> $case) : array<string, string>
Parameters
$case : array<string, mixed>
Return values
array<string, string>

text()

One of a case's text fields.

private static text(array<string, mixed> $case, string $key) : string
Parameters
$case : array<string, mixed>
$key : string
Return values
string

truth()

Whether a body was identified, as the suite reads it.

private static truth(bool $yes) : string
Parameters
$yes : bool
Return values
string
On this page

Search results