Korin API

Ages
in package
implements NodeRule

FinalYes

Ages by the 7.0 grammar: lowercase units in the order y m w d, one space between parts and after "<" or ">" ("<0Y" → "< 0y", "11m 99y" → "99y 11m"); a number without a unit is years, as most 5.5.1 programs read it. CHILD, INFANT and STILLBORN become "< 8y", "< 1y" and "0y" with the word as PHRASE; anything else becomes PHRASE of an empty age.

Table of Contents

Interfaces

NodeRule
A rule for one structure at a time. Rules that look at every line of a record are grouped in {@see Rule\Nodes}, which walks each record once for all of them.

Methods

convert()  : array{string, ?string}|null
needsPrepass()  : bool
Whether the rule needs Context::prepass(): facts about the whole input before the first record.
node()  : bool
Converts one structure (a record or a substructure; never a CONC/CONT line) with one of the rule's tags, as the structure is tagged when the walk reaches it, in place. Its substructures are visited after it, as they are when this returns.
tags()  : array<int, string>|null

Methods

convert()

public convert(string $value) : array{string, ?string}|null
Parameters
$value : string
Return values
array{string, ?string}|null —

the 7.0 age ('' for none) and PHRASE; null when nothing changes

needsPrepass()

Whether the rule needs Context::prepass(): facts about the whole input before the first record.

public needsPrepass() : bool
Return values
bool

node()

Converts one structure (a record or a substructure; never a CONC/CONT line) with one of the rule's tags, as the structure is tagged when the walk reaches it, in place. Its substructures are visited after it, as they are when this returns.

public node(Document $document, int $id, Context $context) : bool
Parameters
$document : Document
$id : int
$context : Context
Return values
bool —

false when the rule removed the structure: the rules after it and its substructures are skipped

tags()

public tags() : array<int, string>|null
Return values
array<int, string>|null —

the tags of the structures the rule converts; null for every structure

On this page

Search results