Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes

IntervalUnit Class Reference
[Widely used base classes and interfaces]

List of all members.

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

Detailed Description

Definition at line 15 of file IntervalUnit.class.php.


Constructor & Destructor Documentation

IntervalUnit::__construct ( name  )  [private]

Definition at line 186 of file IntervalUnit.class.php.

References $name, getUnits(), and Assert::isEqual().

Here is the call graph for this function:


Member Function Documentation

IntervalUnit::compareTo ( IntervalUnit unit  ) 

Definition at line 166 of file IntervalUnit.class.php.

IntervalUnit::countInRange ( DateRange range,
overlappedBounds = true 
)
static IntervalUnit::create ( name  )  [static]

Definition at line 23 of file IntervalUnit.class.php.

References $name, and getInstance().

Referenced by countInRange(), and truncate().

Here is the call graph for this function:

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 
)
Returns:
Timestamp

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().

Here is the call graph for this function:


Member Data Documentation

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.


The documentation for this class was generated from the following file: