An abstract class that represent a date period and provide some base helpers
Implements:
PeriodInterface
| __construct( int $firstWeekday = Day::MONDAY) | ||
| DateTime | getBegin() | |
| DateTime | getEnd() | |
| bool |
contains( DateTime $date)
Checks if the given period is contained in the current period |
|
| bool |
equals( PeriodInterface $period)
Checks if a period is equals to an other |
|
| bool |
includes( PeriodInterface $period, bool $strict = true)
Returns true if the period include the other period given as argument |
|
| boolean |
containsEvent( EventInterface $event)
Returns if $event is during this period. |
|
| string |
format( string $format)
Format the period to a string |
|
| bool |
isCurrent()
Returns if the current period is the current one |
|
| PeriodInterface |
getNext()
Gets the next period of the same type |
|
| PeriodInterface |
getPrevious()
Gets the previous period of the same type |
|
| setFirstWeekday( int $firstWeekday) | ||
| int | getFirstWeekday() |
public
__construct( int $firstWeekday = Day::MONDAY)
| Parameters |
|
|||
|---|---|---|---|---|
| Exceptions |
|
|||
public DateTime
getBegin()
public DateTime
getEnd()
public bool
contains( DateTime $date)
Checks if the given period is contained in the current period
| Parameters |
|
|||
|---|---|---|---|---|
| Return Value |
|
|||
public bool
equals( PeriodInterface $period)
public bool
includes( PeriodInterface $period, bool $strict = true)
Returns true if the period include the other period given as argument
| Parameters |
|
||||||
|---|---|---|---|---|---|---|---|
| Return Value |
|
||||||
public boolean
containsEvent( EventInterface $event)
Returns if $event is during this period.
Non strict. Must return true if : * Event is during period * Period is during event * Event begin is during Period * Event end is during Period
| Parameters |
|
|||
|---|---|---|---|---|
| Return Value |
|
|||
public string
format( string $format)
Format the period to a string
| Parameters |
|
|||
|---|---|---|---|---|
| Return Value |
|
|||
public bool
isCurrent()
Returns if the current period is the current one
| Return Value |
|
|---|
public PeriodInterface
getNext()
public PeriodInterface
getPrevious()
public
setFirstWeekday( int $firstWeekday)
| Parameters |
|
|||
|---|---|---|---|---|
public int
getFirstWeekday()
| Return Value |
|
|---|