Korin API

Parser
in package

Read onlyYes
FinalYes

Builds a lossless {@see Document} from raw bytes.

Table of Contents

Constants

LINE  : mixed = '/^[ \t]*(\d{1,3})(?:[ \t]+(@[^@]+@))?[ \t]+([^...
Level, optional xref, tag, optional value after exactly one delimiter.

Methods

__construct()  : mixed
checkFile()  : Version|null
declaredVersion()  : Version|null
parse()  : Document
parseRecord()  : Document
parseRecords()  : Document

Constants

LINE

Level, optional xref, tag, optional value after exactly one delimiter.

public mixed LINE = '/^[ \t]*(\d{1,3})(?:[ \t]+(@[^@]+@))?[ \t]+([^ \t]+)(?: (.*))?$/s'

Methods

checkFile()

public checkFile(Node|null $first, bool $hasTrailer, int|null $afterTrailer, Node|null $head, ReadOptions $options, callable(Diagnostic): void $add) : Version|null
Parameters
$first : Node|null
$hasTrailer : bool
$afterTrailer : int|null

line of the first record after the last TRLR; null when there is none

$head : Node|null
$options : ReadOptions
$add : callable(Diagnostic): void
Return values
Version|null —

the declared version; null when it is unknown or given in the options

declaredVersion()

public static declaredVersion(Node $head[, bool $dialects = true ]) : Version|null
Parameters
$head : Node
$dialects : bool = true
Return values
Version|null

parseRecords()

public parseRecords(array<int, array{string, int}> $records, Encoding $encoding, Version $version, bool $bom, string $lineEnding, ReadOptions $options) : Document
Parameters
$records : array<int, array{string, int}>

bytes and first line of each, in file order

$encoding : Encoding
$version : Version
$bom : bool
$lineEnding : string
$options : ReadOptions
Return values
Document
On this page

Search results