Public Member Functions | |
getName () | |
truncate (Date $time, $ceil=false) | |
countInRange (DateRange $range, $overlappedBounds=true) | |
compareTo (IntervalUnit $unit) | |
Static Public Member Functions | |
static | create ($name) |
Private Member Functions | |
__construct ($name) | |
Static Private Member Functions | |
static | getUnits () |
static | getInstance ($id) |
Private Attributes | |
$name = null | |
$months = null | |
$days = null | |
$seconds = null |
Definition at line 15 of file IntervalUnit.class.php.
IntervalUnit::__construct | ( | $ | name | ) | [private] |
Definition at line 186 of file IntervalUnit.class.php.
References $name, getUnits(), and Assert::isEqual().
IntervalUnit::compareTo | ( | IntervalUnit $ | unit | ) |
Definition at line 166 of file IntervalUnit.class.php.
IntervalUnit::countInRange | ( | DateRange $ | range, | |
$ | overlappedBounds = true | |||
) |
Definition at line 111 of file IntervalUnit.class.php.
References Date::create(), create(), Date::dayDifference(), DateRange::getEnd(), DateRange::getStart(), Assert::isEqual(), DateRange::toTimestampRange(), and truncate().
static IntervalUnit::create | ( | $ | name | ) | [static] |
Definition at line 23 of file IntervalUnit.class.php.
References $name, and getInstance().
Referenced by countInRange(), and truncate().
static IntervalUnit::getInstance | ( | $ | id | ) | [static, private] |
Definition at line 244 of file IntervalUnit.class.php.
Referenced by create().
IntervalUnit::getName | ( | ) |
Definition at line 28 of file IntervalUnit.class.php.
Referenced by DateUtils::makeDatesListByRange().
static IntervalUnit::getUnits | ( | ) | [static, private] |
Definition at line 220 of file IntervalUnit.class.php.
Referenced by __construct().
IntervalUnit::truncate | ( | Date $ | time, | |
$ | ceil = false | |||
) |
Emulates PostgreSQL's date_trunc() function
Definition at line 39 of file IntervalUnit.class.php.
References $months, create(), Date::dayDifference(), Date::getDay(), Date::getMonth(), Date::getYear(), Assert::isEqual(), Assert::isUnreachable(), Date::spawn(), Date::toDate(), Date::toStamp(), and Date::toTimestamp().
Referenced by countInRange(), and DateUtils::makeDatesListByRange().
IntervalUnit::$days = null [private] |
Definition at line 20 of file IntervalUnit.class.php.
IntervalUnit::$months = null [private] |
Definition at line 19 of file IntervalUnit.class.php.
Referenced by truncate().
IntervalUnit::$name = null [private] |
Definition at line 17 of file IntervalUnit.class.php.
Referenced by __construct(), and create().
IntervalUnit::$seconds = null [private] |
Definition at line 21 of file IntervalUnit.class.php.