Fork me on Github

Class CalendR\Period\ Week

Represents a week


Inherits from: PeriodAbstract
Implements: Iterator

Methods

__construct( DateTime $start, int $firstWeekday = Day::MONDAY)

DateTime getBegin()

from PeriodAbstract
DateTime getEnd()

from PeriodAbstract
bool contains( DateTime $date)

Checks if the given period is contained in the current period

from PeriodAbstract
bool equals( PeriodInterface $period)

Checks if a period is equals to an other

from PeriodAbstract
bool includes( PeriodInterface $period, bool $strict = true)

Returns true if the period include the other period given as argument

from PeriodAbstract
boolean containsEvent( EventInterface $event)

Returns if $event is during this period.

from PeriodAbstract
string format( string $format)

Format the period to a string

from PeriodAbstract
bool isCurrent()

Returns if the current period is the current one

from PeriodAbstract
PeriodInterface getNext()

Gets the next period of the same type

from PeriodAbstract
PeriodInterface getPrevious()

Gets the previous period of the same type

from PeriodAbstract
setFirstWeekday( int $firstWeekday)

from PeriodAbstract
int getFirstWeekday()

from PeriodAbstract
int getNumber()

DatePeriod getDatePeriod()

Returns the period as a DatePeriod

static bool isValid( DateTime $start)

current()

{@inheritDoc}

next()

{@inheritDoc}

key()

{@inheritDoc}

valid()

{@inheritDoc}

rewind()

{@inheritDoc}

string __toString()

Returns the week number

static DateInterval getDateInterval()

Returns a \DateInterval equivalent to the period

Details

public __construct( DateTime $start, int $firstWeekday = Day::MONDAY)

Parameters
DateTime $start
int $firstWeekday
Exceptions
NotAWeek

public DateTime getBegin()

Return Value
DateTime

public DateTime getEnd()

Return Value
DateTime

public bool contains( DateTime $date)

Checks if the given period is contained in the current period

Parameters
DateTime $date
Return Value
bool true if the period contains this date

public bool equals( PeriodInterface $period)

Checks if a period is equals to an other

Parameters
PeriodInterface $period
Return Value
bool

public bool includes( PeriodInterface $period, bool $strict = true)

Returns true if the period include the other period given as argument

Parameters
PeriodInterface $period
bool $strict
Return Value
bool

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
EventInterface $event
Return Value
boolean

public string format( string $format)

Format the period to a string

Parameters
string $format
Return Value
string

public bool isCurrent()

Returns if the current period is the current one

Return Value
bool

public PeriodInterface getNext()

Gets the next period of the same type

Return Value
PeriodInterface

public PeriodInterface getPrevious()

Gets the previous period of the same type

Return Value
PeriodInterface

public setFirstWeekday( int $firstWeekday)

Parameters
int $firstWeekday

public int getFirstWeekday()

Return Value
int

public int getNumber()

Return Value
int

public DatePeriod getDatePeriod()

Returns the period as a DatePeriod

Return Value
DatePeriod

static public bool isValid( DateTime $start)

Parameters
DateTime $start
Return Value
bool

public current()

{@inheritDoc}

public next()

{@inheritDoc}

public key()

{@inheritDoc}

public valid()

{@inheritDoc}

public rewind()

{@inheritDoc}

public string __toString()

Returns the week number

Return Value
string

static public DateInterval getDateInterval()

Returns a \DateInterval equivalent to the period

Return Value
DateInterval