Korin API

GedcomDate
in package
implements Stringable

Read onlyYes
FinalYes

A date value: a kind (a date, a range, a period, an approximation or none), its dates and a phrase. The same value object for every version: {@see self::parse()} reads the grammar of a version, {@see self::toGedcom()} writes it. In 7.0 the phrase is not part of the value but the PHRASE substructure; in 5.x it is "INT date (phrase)" or "(phrase)".

Only what the validator finds valid without a warning is parsed: no day beyond its month, no dual year that is not the following year.

Table of Contents

Interfaces

Stringable

Properties

$date  : Date|null
$endDate  : Date|null
$kind  : DateKind
$phrase  : string|null

Methods

__construct()  : mixed
__toString()  : string
days()  : array{int, int}|null
The days the value can mean, as Julian Day Numbers, PHP_INT_MIN / PHP_INT_MAX for an open end: "BEF 1907" ends on 31 DEC 1907, "BET 1900 AND 1910" spans both years, and so does a range that names its end first ("BET 1910 AND 1900", valid if odd). Null when they are not certain: approximations, no date, other calendars than Gregorian and Julian.
of()  : self
"6 DEC 1907", "JULIAN 1650": one date.
parse()  : self
toGedcom()  : string
The value as the version writes it; a 7.0 value leaves the phrase to PHRASE.
tryParse()  : self|null
withPhrase()  : self

Properties

Methods

__construct()

public __construct(DateKind $kind[, Date|null $date = null ][, Date|null $endDate = null ][, string|null $phrase = null ]) : mixed
Parameters
$kind : DateKind
$date : Date|null = null
$endDate : Date|null = null
$phrase : string|null = null

__toString()

public __toString() : string
Return values
string

days()

The days the value can mean, as Julian Day Numbers, PHP_INT_MIN / PHP_INT_MAX for an open end: "BEF 1907" ends on 31 DEC 1907, "BET 1900 AND 1910" spans both years, and so does a range that names its end first ("BET 1910 AND 1900", valid if odd). Null when they are not certain: approximations, no date, other calendars than Gregorian and Julian.

public days() : array{int, int}|null
Return values
array{int, int}|null

of()

"6 DEC 1907", "JULIAN 1650": one date.

public static of(Date $date) : self
Parameters
$date : Date
Return values
self

toGedcom()

The value as the version writes it; a 7.0 value leaves the phrase to PHRASE.

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

when the version cannot write it: a dual year or a 5.x calendar in 7.0; a 7.0 extension, or a phrase with anything but one date or none, 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