GedcomDate
in package
implements
Stringable
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
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
$date
public
Date|null
$date
= null
$endDate
public
Date|null
$endDate
= null
$kind
public
DateKind
$kind
$phrase
public
string|null
$phrase
= null
Methods
__construct()
public
__construct(DateKind $kind[, Date|null $date = null ][, Date|null $endDate = null ][, string|null $phrase = null ]) : mixed
Parameters
__toString()
public
__toString() : string
Return values
stringdays()
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}|nullof()
"6 DEC 1907", "JULIAN 1650": one date.
public
static of(Date $date) : self
Parameters
- $date : Date
Return values
selfparse()
public
static parse(string $value[, Version $version = Version::V7_0 ]) : self
Parameters
- $value : string
- $version : Version = Version::V7_0
Tags
Return values
selftoGedcom()
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
Return values
stringtryParse()
public
static tryParse(string $value[, Version $version = Version::V7_0 ]) : self|null
Parameters
- $value : string
- $version : Version = Version::V7_0
Return values
self|nullwithPhrase()
public
withPhrase(string|null $phrase) : self
Parameters
- $phrase : string|null