Korin API

Age
in package
implements Stringable

Read onlyYes
FinalYes

An age at an event: a duration in years, months, weeks and days, or a 5.x word (CHILD, INFANT, STILLBORN), with "<" or ">" before it, and a phrase. The same value object for every version: {@see self::parse()} reads the grammar of a version, {@see self::toGedcom()} writes it. The phrase is the 7.0 PHRASE substructure; 5.x has none.

Table of Contents

Interfaces

Stringable

Constants

CHILD  : mixed = 'CHILD'
INFANT  : mixed = 'INFANT'
STILLBORN  : mixed = 'STILLBORN'

Properties

$bound  : AgeBound|null
$days  : int|null
$months  : int|null
$phrase  : string|null
$weeks  : int|null
$word  : string|null
$years  : int|null

Methods

__construct()  : mixed
__toString()  : string
isEmpty()  : bool
No duration and no word: a 7.0 age that is only a phrase.
parse()  : self
toGedcom()  : string
The value as the version writes it: "< 8y" in 7.0 and 5.5.5, "<8y" in 5.5 and 5.5.1. The phrase is not part of it.
tryParse()  : self|null
withPhrase()  : self

Constants

CHILD

public mixed CHILD = 'CHILD'

INFANT

public mixed INFANT = 'INFANT'

STILLBORN

public mixed STILLBORN = 'STILLBORN'

Properties

$days

public int|null $days = null

$months

public int|null $months = null

$phrase

public string|null $phrase = null

$weeks

public int|null $weeks = null

$word

public string|null $word = null

$years

public int|null $years = null

Methods

__construct()

public __construct([int|null $years = null ][, int|null $months = null ][, int|null $weeks = null ][, int|null $days = null ][, AgeBound|null $bound = null ][, string|null $word = null ][, string|null $phrase = null ]) : mixed
Parameters
$years : int|null = null
$months : int|null = null
$weeks : int|null = null
$days : int|null = null
$bound : AgeBound|null = null
$word : string|null = null
$phrase : string|null = null

__toString()

public __toString() : string
Return values
string

isEmpty()

No duration and no word: a 7.0 age that is only a phrase.

public isEmpty() : bool
Return values
bool

toGedcom()

The value as the version writes it: "< 8y" in 7.0 and 5.5.5, "<8y" in 5.5 and 5.5.1. The phrase is not part of it.

public toGedcom([Version $version = Version::V7_0 ]) : string
Parameters
$version : Version = Version::V7_0
Tags
throws
InvalidValueException

when the version cannot write it: a word in 7.0, weeks or an empty age in 5.x

Return values
string

withPhrase()

public withPhrase(string|null $phrase) : self
Parameters
$phrase : string|null
Return values
self
On this page

Search results