# DateRange Class Reference
[Common wrapper and helper classes]

Date's interval implementation and accompanying utility methods. More...

Inheritance diagram for DateRange:
[legend]

List of all members.

## Public Member Functions

| __construct ($start=null, $end=null)
| __clone ()
| setStart ($start)
| safeSetStart ($start)
| safeSetEnd ($end)
| setEnd ($end)
| lazySet ($start=null, $end=null)
| dropStart ()
| dropEnd ()
| isEmpty ()
| getStart ()
| getEnd ()
| toDateString ($internalDelimiter= '-', $dateDelimiter= '- ')
| toString ($delimiter= '- ')
| overlaps (DateRange $range)
| contains ($date)
| split ()
| isNeighbour (DateRange $range)
| isOpen ()
| enlarge (DateRange $range)
| enlarges $this by given $range, if last one is wider
| clip (DateRange $range)
| intersection of $this and given $range
| lightCopyOnClip (DateRange $range)
| result is read-only, no error checking
| getStartStamp ()
| getEndStamp ()
| isOneDay ()
| toTimestampRange ()

## Static Public Member Functions

static | create ($start=null, $end=null)
static | merge ($array)
static | compare (DateRange $left, DateRange $right)

## Protected Member Functions

| checkType ($value)
| getObjectName ()

## Private Attributes

| $start = null
| $end = null
| $dayStartStamp = null
| $dayEndStamp = null

## Detailed Description

Date's interval implementation and accompanying utility methods.

See also:
  Date
  TimestampRange

Definition at line 20 of file DateRange.class.php.

## Constructor & Destructor Documentation

DateRange::__construct | ( | $ | start = `null`,
|  | $ | end = `null` |
| ) |  |  |

Definition at line 36 of file DateRange.class.php.

References $end, $start, setEnd(), and setStart().

Here is the call graph for this function:

## Member Function Documentation

DateRange::__clone | ( |  | ) |

Definition at line 45 of file DateRange.class.php.

DateRange::checkType | ( | $ | value | ) | `[protected]`

Definition at line 550 of file DateRange.class.php.

References getObjectName(), ClassUtils::isInstanceOf(), and Assert::isTrue().

Referenced by contains(), lazySet(), setEnd(), and setStart().

Here is the call graph for this function:

DateRange::clip | ( | DateRange $ | range | ) |

intersection of $this and given $range

Returns:
  DateRange

Definition at line 401 of file DateRange.class.php.

References Assert::isTrue(), and overlaps().

Here is the call graph for this function:

static DateRange::compare | ( | DateRange $ | left,
|  | DateRange $ | right |
| ) |  |  | `[static]`

Definition at line 490 of file DateRange.class.php.

References getEndStamp(), getStartStamp(), and isEmpty().

Here is the call graph for this function:

DateRange::contains | ( | $ | date | ) |

Implements SingleRange.

Definition at line 283 of file DateRange.class.php.

References $end, $start, checkType(), getEndStamp(), and getStartStamp().

Here is the call graph for this function:

static DateRange::create | ( | $ | start = `null`,
|  | $ | end = `null` |
| ) |  |  | `[static]`

Returns:
  DateRange

Reimplemented in TimestampRange.

Definition at line 31 of file DateRange.class.php.

References $end, and $start.

Referenced by lightCopyOnClip(), DateRangeList::makeRange(), and toTimestampRange().

DateRange::dropEnd | ( |  | ) |

Returns:
  DateRange

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

DateRange::dropStart | ( |  | ) |

Returns:
  DateRange

Definition at line 156 of file DateRange.class.php.

DateRange::enlarge | ( | DateRange $ | range | ) |

enlarges $this by given $range, if last one is wider

Returns:
  DateRange

Definition at line 375 of file DateRange.class.php.

DateRange::getEnd | ( |  | ) |

Returns:
  Date

Implements SingleRange.

Definition at line 191 of file DateRange.class.php.

Referenced by IntervalUnit::countInRange(), TimestampRange::getEndStamp(), DateUtils::makeDatesListByRange(), safeSetStart(), and toTimestampRange().

DateRange::getEndStamp | ( |  | ) |

Reimplemented in TimestampRange.

Definition at line 477 of file DateRange.class.php.

Referenced by PrimitiveDateRange::checkRanges(), compare(), contains(), and overlaps().

DateRange::getObjectName | ( |  | ) | `[protected]`

Reimplemented in TimestampRange.

Definition at line 557 of file DateRange.class.php.

Referenced by checkType().

DateRange::getStart | ( |  | ) |

Returns:
  Date

Implements SingleRange.

Definition at line 183 of file DateRange.class.php.

Referenced by IntervalUnit::countInRange(), TimestampRange::getStartStamp(), DateUtils::makeDatesListByRange(), safeSetEnd(), and toTimestampRange().

DateRange::getStartStamp | ( |  | ) |

Reimplemented in TimestampRange.

Definition at line 464 of file DateRange.class.php.

Referenced by PrimitiveDateRange::checkRanges(), compare(), contains(), and overlaps().

DateRange::isEmpty | ( |  | ) |

Definition at line 173 of file DateRange.class.php.

Referenced by compare(), and overlaps().

DateRange::isNeighbour | ( | DateRange $ | range | ) |

Definition at line 346 of file DateRange.class.php.

References isOpen(), Assert::isTrue(), and overlaps().

Here is the call graph for this function:

DateRange::isOneDay | ( |  | ) |

Definition at line 532 of file DateRange.class.php.

References isOpen().

Here is the call graph for this function:

DateRange::isOpen | ( |  | ) |

Definition at line 365 of file DateRange.class.php.

Referenced by isNeighbour(), isOneDay(), and split().

DateRange::lazySet | ( | $ | start = `null`,
|  | $ | end = `null` |
| ) |  |  |

Returns:
  DateRange

Definition at line 132 of file DateRange.class.php.

References $end, $start, checkType(), setEnd(), and setStart().

Here is the call graph for this function:

DateRange::lightCopyOnClip | ( | DateRange $ | range | ) |

result is read-only, no error checking

Returns:
  DateRange

Definition at line 433 of file DateRange.class.php.

References create().

Here is the call graph for this function:

static DateRange::merge | ( | $ | array | ) | `[static]`

Definition at line 326 of file DateRange.class.php.

DateRange::overlaps | ( | DateRange $ | range | ) |

Definition at line 229 of file DateRange.class.php.

References getEndStamp(), getStartStamp(), and isEmpty().

Referenced by clip(), and isNeighbour().

Here is the call graph for this function:

DateRange::safeSetEnd | ( | $ | end | ) |

Returns:
  DateRange

Definition at line 95 of file DateRange.class.php.

References $end, Date::compare(), getStart(), and setEnd().

Here is the call graph for this function:

DateRange::safeSetStart | ( | $ | start | ) |

Returns:
  DateRange

Definition at line 76 of file DateRange.class.php.

References $start, Date::compare(), getEnd(), and setStart().

Here is the call graph for this function:

DateRange::setEnd | ( | $ | end | ) |

Exceptions:

  | WrongArgumentException |

Returns:
  DateRange

Definition at line 115 of file DateRange.class.php.

References $end, and checkType().

Referenced by __construct(), lazySet(), and safeSetEnd().

Here is the call graph for this function:

DateRange::setStart | ( | $ | start | ) |

Exceptions:

  | WrongArgumentException |

Returns:
  DateRange

Definition at line 58 of file DateRange.class.php.

References $start, and checkType().

Referenced by __construct(), lazySet(), and safeSetStart().

Here is the call graph for this function:

DateRange::split | ( |  | ) |

Definition at line 302 of file DateRange.class.php.

References $start, Assert::isFalse(), isOpen(), and Date::modify().

Here is the call graph for this function:

DateRange::toDateString | ( | $ | internalDelimiter = `'-'`,
|  | $ | dateDelimiter = `' - '` |
| ) |  |  |

Definition at line 196 of file DateRange.class.php.

DateRange::toString | ( | $ | delimiter = `' - '` | ) |

Definition at line 214 of file DateRange.class.php.

DateRange::toTimestampRange | ( |  | ) |

Returns:
  TimestampRange

Reimplemented in TimestampRange.

Definition at line 541 of file DateRange.class.php.

References create(), getEnd(), and getStart().

Referenced by IntervalUnit::countInRange().

Here is the call graph for this function:

## Member Data Documentation

DateRange::$dayEndStamp = null`[private]`

Definition at line 26 of file DateRange.class.php.

DateRange::$dayStartStamp = null`[private]`

Definition at line 25 of file DateRange.class.php.

DateRange::$end = null`[private]`

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

Referenced by __construct(), contains(), TimestampRange::create(), create(), TimestampRange::getEndStamp(), lazySet(), safeSetEnd(), and setEnd().

DateRange::$start = null`[private]`

Definition at line 22 of file DateRange.class.php.

Referenced by __construct(), contains(), TimestampRange::create(), create(), TimestampRange::getStartStamp(), lazySet(), safeSetStart(), setStart(), and split().

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

- main/Base/DateRange.class.php