Documentation

CarbonPeriod
in package
implements Iterator, Countable

Substitution of DatePeriod with some modifications and many more features.

Fully compatible with PHP 5.3+!

Interfaces, Classes and Traits

Iterator
Countable

Table of Contents

END_DATE_FILTER  = 'Carbon\CarbonPeriod::filterEndDate'
END_ITERATION  = 'Carbon\CarbonPeriod::endIteration'
Special value which can be returned by filters to end iteration. Also a filter.
EXCLUDE_END_DATE  = 2
EXCLUDE_START_DATE  = 1
Available options.
NEXT_MAX_ATTEMPTS  = 1000
Number of maximum attempts before giving up on finding next valid date.
RECURRENCES_FILTER  = 'Carbon\CarbonPeriod::filterRecurrences'
Built-in filters.
$current  : Carbon
Current date. May temporarily hold unaccepted value when looking for a next valid date.
$dateInterval  : CarbonInterval
Underlying date interval instance. Always present, one day by default.
$endDate  : Carbon|null
Period end date. For inverted interval should be before the start date. Applied via a filter.
$filters  : array<string|int, mixed>
The filters stack.
$isDefaultInterval  : bool
Whether current date interval was set by default.
$key  : int
Index of current date. Always sequential, even if some dates are skipped by filters.
$macros  : array<string|int, mixed>
The registered macros.
$options  : int
Iteration options.
$recurrences  : int|null
Limit for number of recurrences. Applied via a filter.
$startDate  : Carbon
Period start date. Applied on rewind. Always present, now by default.
$timezone  : DateTimeZone|null
Timezone of current date. Taken from the start date.
$validationResult  : bool|string|null
The cached validation result for current date.
__call()  : mixed
Add aliases for setters.
__callStatic()  : mixed
Provide static proxy for instance aliases.
__construct()  : mixed
CarbonPeriod constructor.
__toString()  : string
Convert the date period into a string.
addFilter()  : $this
Add a filter to the stack.
between()  :
count()  : int
Count dates in the date period.
create()  : static
Create a new instance.
createFromArray()  : static
Create a new instance from an array of parameters.
createFromIso()  : static
Create CarbonPeriod from ISO 8601 string.
current()  : Carbon|null
Return the current date.
dates()  :
dates()  :
day()  :
day()  :
days()  :
days()  :
dayz()  :
dayz()  :
each()  :
end()  :
end()  :
every()  :
excludeEndDate()  : $this
Toggle EXCLUDE_END_DATE option.
excludeStartDate()  : $this
Toggle EXCLUDE_START_DATE option.
filter()  :
filter()  :
filters()  :
filters()  :
first()  : Carbon|null
Return the first date in the date period.
getDateInterval()  : CarbonInterval
Get the underlying date interval.
getEndDate()  : Carbon|null
Get end date of the period.
getFilters()  : array<string|int, mixed>
Get filters stack.
getOptions()  : int
Get the period options.
getRecurrences()  : int|null
Get number of recurrences.
getStartDate()  : Carbon
Get start date of the period.
hasFilter()  : bool
Return whether given instance or name is in the filter stack.
hasMacro()  : bool
Check if macro is registered.
hour()  :
hour()  :
hours()  :
hours()  :
interval()  :
interval()  :
invert()  :
invert()  :
invertDateInterval()  : $this
Invert the period date interval.
isEndExcluded()  : bool
Returns true if the end date should be excluded.
isStartExcluded()  : bool
Returns true if the start date should be excluded.
key()  : int|null
Return the current key.
last()  : Carbon|null
Return the last date in the date period.
macro()  : void
Register a custom macro.
minute()  :
minute()  :
minutes()  :
minutes()  :
mixin()  : void
Register macros from a mixin object.
month()  :
month()  :
months()  :
months()  :
next()  : void
Move forward to the next date.
options()  :
options()  :
prepend()  :
prepend()  :
prependFilter()  : $this
Prepend a filter to the stack.
push()  :
push()  :
recurrences()  :
recurrences()  :
removeFilter()  : $this
Remove a filter by instance or name.
resetFilters()  : $this
Reset filters stack.
resetMacros()  : mixed
Remove all macros.
rewind()  : void
Rewind to the start date.
second()  :
second()  :
seconds()  :
seconds()  :
setDateInterval()  : $this
Change the period date interval.
setDates()  : $this
Set start and end date.
setEndDate()  : $this
Change the period end date.
setFilters()  : $this
Set filters stack.
setOptions()  : $this
Change the period options.
setRecurrences()  : $this
Add a recurrences filter (set maximum number of recurrences).
setStartDate()  : $this
Change the period start date.
since()  :
since()  :
sinceNow()  :
sinceNow()  :
skip()  : bool
Skip iterations and returns iteration state (false if ended, true if still valid).
spec()  : string
Format the date period as ISO 8601.
start()  :
start()  :
step()  :
stepBy()  :
times()  :
times()  :
toArray()  : array<string|int, mixed>
Convert the date period into an array without changing current iteration state.
toggle()  :
toggle()  :
toggleOptions()  : $this
Toggle given options on or off.
toIso8601String()  : string
Format the date period as ISO 8601.
toString()  : string
Convert the date period into a string.
until()  :
until()  :
untilNow()  :
untilNow()  :
valid()  : bool
Check if the current position is valid.
week()  :
week()  :
weeks()  :
weeks()  :
year()  :
year()  :
years()  :
years()  :
addMissingParts()  : string
Add missing parts of the target date from the soure date.
callMacro()  : mixed
Call given macro.
checkFilters()  : bool|string
Check whether current value and key pass all the filters.
createFilterTuple()  : array<string|int, mixed>
Create a filter tuple from raw parameters.
endIteration()  : string
End iteration filter callback.
filterEndDate()  : bool|string
End date filter callback.
filterRecurrences()  : bool|string
Recurrences filter callback (limits number of recurrences).
handleChangedParameters()  : mixed
Handle change of the parameters.
incrementCurrentDateUntilValid()  : void
Keep incrementing the current date until a valid date is found or the iteration is ended.
intervalHasTime()  : bool
Return whether given interval contains non zero value of any time unit.
isCarbonPredicateMethod()  : bool
Return whether given callable is a string pointing to one of Carbon's is* methods and should be automatically converted to a filter callback.
isIso8601()  : bool
Return whether given variable is an ISO 8601 specification.
parseIso8601()  : array<string|int, mixed>
Parse given ISO 8601 string into an array of arguments.
prepareForReturn()  : Carbon
Prepare given date to be returned to the external logic.
updateInternalState()  : void
Update properties after removing built-in filters.
validateCurrentDate()  : bool|string
Validate current date and stop iteration when necessary.

Constants

END_DATE_FILTER

public mixed END_DATE_FILTER = 'Carbon\CarbonPeriod::filterEndDate'

END_ITERATION

Special value which can be returned by filters to end iteration. Also a filter.

public string END_ITERATION = 'Carbon\CarbonPeriod::endIteration'

EXCLUDE_START_DATE

Available options.

public int EXCLUDE_START_DATE = 1

NEXT_MAX_ATTEMPTS

Number of maximum attempts before giving up on finding next valid date.

public int NEXT_MAX_ATTEMPTS = 1000

RECURRENCES_FILTER

Built-in filters.

public string RECURRENCES_FILTER = 'Carbon\CarbonPeriod::filterRecurrences'

Properties

$current

Current date. May temporarily hold unaccepted value when looking for a next valid date.

protected Carbon $current

Equal to null only before the first iteration.

$endDate

Period end date. For inverted interval should be before the start date. Applied via a filter.

protected Carbon|null $endDate

$filters

The filters stack.

protected array<string|int, mixed> $filters = array()

$isDefaultInterval

Whether current date interval was set by default.

protected bool $isDefaultInterval

$key

Index of current date. Always sequential, even if some dates are skipped by filters.

protected int $key

Equal to null only before the first iteration.

$macros

The registered macros.

protected static array<string|int, mixed> $macros = array()

$recurrences

Limit for number of recurrences. Applied via a filter.

protected int|null $recurrences

$startDate

Period start date. Applied on rewind. Always present, now by default.

protected Carbon $startDate

$timezone

Timezone of current date. Taken from the start date.

protected DateTimeZone|null $timezone

$validationResult

The cached validation result for current date.

protected bool|string|null $validationResult

Methods

__call()

Add aliases for setters.

public __call(string $method, array<string|int, mixed> $parameters) : mixed

CarbonPeriod::days(3)->hours(5)->invert() ->sinceNow()->until('2010-01-10') ->filter(...) ->count()

Note: We use magic method to let static and instance aliases with the same names.

Parameters
$method : string
$parameters : array<string|int, mixed>
Return values
mixed

__callStatic()

Provide static proxy for instance aliases.

public static __callStatic(string $method, array<string|int, mixed> $parameters) : mixed
Parameters
$method : string
$parameters : array<string|int, mixed>
Return values
mixed

__construct()

CarbonPeriod constructor.

public __construct() : mixed
Tags
throws
InvalidArgumentException
Return values
mixed

__toString()

Convert the date period into a string.

public __toString() : string
Return values
string

addFilter()

Add a filter to the stack.

public addFilter(callable $callback[, string $name = null ]) : $this
Parameters
$callback : callable
$name : string = null
Return values
$this

between()

public static between(mixed $start, mixed $end) :

Create instance with start and end date.

Parameters
$start : mixed
$end : mixed
Return values

count()

Count dates in the date period.

public count() : int
Return values
int

create()

Create a new instance.

public static create() : static
Return values
static

createFromArray()

Create a new instance from an array of parameters.

public static createFromArray(array<string|int, mixed> $params) : static
Parameters
$params : array<string|int, mixed>
Return values
static

createFromIso()

Create CarbonPeriod from ISO 8601 string.

public static createFromIso(string $iso[, int|null $options = null ]) : static
Parameters
$iso : string
$options : int|null = null
Return values
static

dates()

public dates(mixed $start, mixed $end) :

Change the period start and end date.

Parameters
$start : mixed
$end : mixed
Return values

dates()

public static dates(mixed $start, mixed $end) :

Create instance with start and end date.

Parameters
$start : mixed
$end : mixed
Return values

day()

public day(mixed $days) :

Alias for days().

Parameters
$days : mixed
Return values

day()

public static day(mixed $days) :

Alias for days().

Parameters
$days : mixed
Return values

days()

public static days(mixed $days) :

Create instance specifying a number of days for date interval.

Parameters
$days : mixed
Return values

days()

public days(mixed $days) :

Set the days portion of the date interval.

Parameters
$days : mixed
Return values

dayz()

public dayz(mixed $days) :

Alias for days().

Parameters
$days : mixed
Return values

dayz()

public static dayz(mixed $days) :

Alias for days().

Parameters
$days : mixed
Return values

each()

public static each(mixed $interval) :

Create instance with given date interval.

Parameters
$interval : mixed
Return values

end()

public end(mixed $date, mixed $inclusive) :

Change the period end date.

Parameters
$date : mixed
$inclusive : mixed
Return values

end()

public static end(mixed $date, mixed $inclusive) :

Create instance specifying end date.

Parameters
$date : mixed
$inclusive : mixed
Return values

every()

public static every(mixed $interval) :

Create instance with given date interval.

Parameters
$interval : mixed
Return values

excludeEndDate()

Toggle EXCLUDE_END_DATE option.

public excludeEndDate([bool $state = true ]) : $this
Parameters
$state : bool = true
Return values
$this

excludeStartDate()

Toggle EXCLUDE_START_DATE option.

public excludeStartDate([bool $state = true ]) : $this
Parameters
$state : bool = true
Return values
$this

filter()

public filter(mixed $callback, mixed $name) :

Add a filter to the stack.

Parameters
$callback : mixed
$name : mixed
Return values

filter()

public static filter(mixed $callback, mixed $name) :

Create instance with filter added to the stack.

Parameters
$callback : mixed
$name : mixed
Return values

filters()

public filters(array<string|int, mixed> $filters = array() :

) Set filters stack.

Parameters
$filters = array( : array<string|int, mixed>
Return values

filters()

public static filters(array<string|int, mixed> $filters) :

Create instance with filters stack.

Parameters
$filters : array<string|int, mixed>
Return values

getFilters()

Get filters stack.

public getFilters() : array<string|int, mixed>
Return values
array<string|int, mixed>

getOptions()

Get the period options.

public getOptions() : int
Return values
int

getRecurrences()

Get number of recurrences.

public getRecurrences() : int|null
Return values
int|null

hasFilter()

Return whether given instance or name is in the filter stack.

public hasFilter(callable|string $filter) : bool
Parameters
$filter : callable|string
Return values
bool

hasMacro()

Check if macro is registered.

public static hasMacro(string $name) : bool
Parameters
$name : string
Return values
bool

hour()

public static hour(mixed $hours) :

Alias for hours().

Parameters
$hours : mixed
Return values

hour()

public hour(mixed $hours) :

Alias for hours().

Parameters
$hours : mixed
Return values

hours()

public static hours(mixed $hours) :

Create instance specifying a number of hours for date interval.

Parameters
$hours : mixed
Return values

hours()

public hours(mixed $hours) :

Set the hours portion of the date interval.

Parameters
$hours : mixed
Return values

interval()

public static interval(mixed $interval) :

Create instance with given date interval.

Parameters
$interval : mixed
Return values

interval()

public interval(mixed $interval) :

Change the period date interval.

Parameters
$interval : mixed
Return values

invert()

public static invert() :

Create instance with inverted date interval.

Return values

invert()

public invert() :

Invert the period date interval.

Return values

invertDateInterval()

Invert the period date interval.

public invertDateInterval() : $this
Return values
$this

isEndExcluded()

Returns true if the end date should be excluded.

public isEndExcluded() : bool
Return values
bool

isStartExcluded()

Returns true if the start date should be excluded.

public isStartExcluded() : bool
Return values
bool

key()

Return the current key.

public key() : int|null
Return values
int|null

macro()

Register a custom macro.

public static macro(string $name, object|callable $macro) : void
Parameters
$name : string
$macro : object|callable
Return values
void

minute()

public minute(mixed $minutes) :

Alias for minutes().

Parameters
$minutes : mixed
Return values

minute()

public static minute(mixed $minutes) :

Alias for minutes().

Parameters
$minutes : mixed
Return values

minutes()

public minutes(mixed $minutes) :

Set the minutes portion of the date interval.

Parameters
$minutes : mixed
Return values

minutes()

public static minutes(mixed $minutes) :

Create instance specifying a number of minutes for date interval.

Parameters
$minutes : mixed
Return values

mixin()

Register macros from a mixin object.

public static mixin(object $mixin) : void
Parameters
$mixin : object
Tags
throws
ReflectionException
Return values
void

month()

public static month(mixed $months) :

Alias for months().

Parameters
$months : mixed
Return values

month()

public month(mixed $months) :

Alias for months().

Parameters
$months : mixed
Return values

months()

public months(mixed $months) :

Set the months portion of the date interval.

Parameters
$months : mixed
Return values

months()

public static months(mixed $months) :

Create instance specifying a number of months for date interval.

Parameters
$months : mixed
Return values

next()

Move forward to the next date.

public next() : void
Tags
throws
RuntimeException
Return values
void

options()

public options(mixed $options) :

Change the period options.

Parameters
$options : mixed
Return values

options()

public static options(mixed $options) :

Create instance with options.

Parameters
$options : mixed
Return values

prepend()

public static prepend(mixed $callback, mixed $name) :

Create instance with filter prepened to the stack.

Parameters
$callback : mixed
$name : mixed
Return values

prepend()

public prepend(mixed $callback, mixed $name) :

Prepend a filter to the stack.

Parameters
$callback : mixed
$name : mixed
Return values

prependFilter()

Prepend a filter to the stack.

public prependFilter(callable $callback[, string $name = null ]) : $this
Parameters
$callback : callable
$name : string = null
Return values
$this

push()

public push(mixed $callback, mixed $name) :

Alias for filter().

Parameters
$callback : mixed
$name : mixed
Return values

push()

public static push(mixed $callback, mixed $name) :

Alias for filter().

Parameters
$callback : mixed
$name : mixed
Return values

recurrences()

public recurrences(mixed $recurrences) :

Change the maximum number of recurrences.

Parameters
$recurrences : mixed
Return values

recurrences()

public static recurrences(mixed $recurrences) :

Create instance with maximum number of recurrences.

Parameters
$recurrences : mixed
Return values

removeFilter()

Remove a filter by instance or name.

public removeFilter(callable|string $filter) : $this
Parameters
$filter : callable|string
Return values
$this

resetFilters()

Reset filters stack.

public resetFilters() : $this
Return values
$this

resetMacros()

Remove all macros.

public static resetMacros() : mixed
Return values
mixed

second()

public static second(mixed $seconds) :

Alias for seconds().

Parameters
$seconds : mixed
Return values

second()

public second(mixed $seconds) :

Alias for seconds().

Parameters
$seconds : mixed
Return values

seconds()

public static seconds(mixed $seconds) :

Create instance specifying a number of seconds for date interval.

Parameters
$seconds : mixed
Return values

seconds()

public seconds(mixed $seconds) :

Set the seconds portion of the date interval.

Parameters
$seconds : mixed
Return values

setDateInterval()

Change the period date interval.

public setDateInterval(DateInterval|string $interval) : $this
Parameters
$interval : DateInterval|string
Tags
throws
InvalidArgumentException
Return values
$this

setDates()

Set start and end date.

public setDates(DateTime|DateTimeInterface|string $start, DateTime|DateTimeInterface|string|null $end) : $this
Parameters
$start : DateTime|DateTimeInterface|string
$end : DateTime|DateTimeInterface|string|null
Return values
$this

setEndDate()

Change the period end date.

public setEndDate(DateTime|DateTimeInterface|string|null $date[, bool|null $inclusive = null ]) : $this
Parameters
$date : DateTime|DateTimeInterface|string|null
$inclusive : bool|null = null
Tags
throws
InvalidArgumentException
Return values
$this

setFilters()

Set filters stack.

public setFilters(array<string|int, mixed> $filters) : $this
Parameters
$filters : array<string|int, mixed>
Return values
$this

setOptions()

Change the period options.

public setOptions(int|null $options) : $this
Parameters
$options : int|null
Tags
throws
InvalidArgumentException
Return values
$this

setRecurrences()

Add a recurrences filter (set maximum number of recurrences).

public setRecurrences(int|null $recurrences) : $this
Parameters
$recurrences : int|null
Tags
throws
InvalidArgumentException
Return values
$this

setStartDate()

Change the period start date.

public setStartDate(DateTime|DateTimeInterface|string $date[, bool|null $inclusive = null ]) : $this
Parameters
$date : DateTime|DateTimeInterface|string
$inclusive : bool|null = null
Tags
throws
InvalidArgumentException
Return values
$this

since()

public since(mixed $date, mixed $inclusive) :

Alias for start().

Parameters
$date : mixed
$inclusive : mixed
Return values

since()

public static since(mixed $date, mixed $inclusive) :

Alias for start().

Parameters
$date : mixed
$inclusive : mixed
Return values

sinceNow()

public sinceNow(mixed $inclusive) :

Change the period start date to now.

Parameters
$inclusive : mixed
Return values

sinceNow()

public static sinceNow(mixed $inclusive) :

Create instance with start date set to now.

Parameters
$inclusive : mixed
Return values

skip()

Skip iterations and returns iteration state (false if ended, true if still valid).

public skip([int $count = 1 ]) : bool
Parameters
$count : int = 1

steps number to skip (1 by default)

Return values
bool

spec()

Format the date period as ISO 8601.

public spec() : string
Return values
string

start()

public static start(mixed $date, mixed $inclusive) :

Create instance specifying start date.

Parameters
$date : mixed
$inclusive : mixed
Return values

start()

public start(mixed $date, mixed $inclusive) :

Change the period start date.

Parameters
$date : mixed
$inclusive : mixed
Return values

step()

public static step(mixed $interval) :

Create instance with given date interval.

Parameters
$interval : mixed
Return values

stepBy()

public static stepBy(mixed $interval) :

Create instance with given date interval.

Parameters
$interval : mixed
Return values

times()

public static times(mixed $recurrences) :

Alias for recurrences().

Parameters
$recurrences : mixed
Return values

times()

public times(mixed $recurrences) :

Alias for recurrences().

Parameters
$recurrences : mixed
Return values

toArray()

Convert the date period into an array without changing current iteration state.

public toArray() : array<string|int, mixed>
Return values
array<string|int, mixed>

toggle()

public static toggle(mixed $options, mixed $state) :

Create instance with options toggled on or off.

Parameters
$options : mixed
$state : mixed
Return values

toggle()

public toggle(mixed $options, mixed $state) :

Toggle given options on or off.

Parameters
$options : mixed
$state : mixed
Return values

toggleOptions()

Toggle given options on or off.

public toggleOptions(int $options[, bool|null $state = null ]) : $this
Parameters
$options : int
$state : bool|null = null
Tags
throws
InvalidArgumentException
Return values
$this

toIso8601String()

Format the date period as ISO 8601.

public toIso8601String() : string
Return values
string

toString()

Convert the date period into a string.

public toString() : string
Return values
string

until()

public until(mixed $date, mixed $inclusive) :

Alias for end().

Parameters
$date : mixed
$inclusive : mixed
Return values

until()

public static until(mixed $date, mixed $inclusive) :

Alias for end().

Parameters
$date : mixed
$inclusive : mixed
Return values

untilNow()

public untilNow(mixed $inclusive) :

Change the period end date to now.

Parameters
$inclusive : mixed
Return values

untilNow()

public static untilNow(mixed $inclusive) :

Create instance with end date set to now.

Parameters
$inclusive : mixed
Return values

valid()

Check if the current position is valid.

public valid() : bool
Return values
bool

week()

public week(mixed $weeks) :

Alias for weeks().

Parameters
$weeks : mixed
Return values

week()

public static week(mixed $weeks) :

Alias for weeks().

Parameters
$weeks : mixed
Return values

weeks()

public weeks(mixed $weeks) :

Set the weeks portion of the date interval.

Parameters
$weeks : mixed
Return values

weeks()

public static weeks(mixed $weeks) :

Create instance specifying a number of weeks for date interval.

Parameters
$weeks : mixed
Return values

year()

public year(mixed $years) :

Alias for years().

Parameters
$years : mixed
Return values

year()

public static year(mixed $years) :

Alias for years().

Parameters
$years : mixed
Return values

years()

public years(mixed $years) :

Set the years portion of the date interval.

Parameters
$years : mixed
Return values

years()

public static years(mixed $years) :

Create instance specifying a number of years for date interval.

Parameters
$years : mixed
Return values

addMissingParts()

Add missing parts of the target date from the soure date.

protected static addMissingParts(string $source, string $target) : string
Parameters
$source : string
$target : string
Return values
string

callMacro()

Call given macro.

protected callMacro(string $name, array<string|int, mixed> $parameters) : mixed
Parameters
$name : string
$parameters : array<string|int, mixed>
Return values
mixed

checkFilters()

Check whether current value and key pass all the filters.

protected checkFilters() : bool|string
Return values
bool|string

createFilterTuple()

Create a filter tuple from raw parameters.

protected createFilterTuple(array<string|int, mixed> $parameters) : array<string|int, mixed>

Will create an automatic filter callback for one of Carbon's is* methods.

Parameters
$parameters : array<string|int, mixed>
Return values
array<string|int, mixed>

endIteration()

End iteration filter callback.

protected endIteration() : string
Return values
string

filterEndDate()

End date filter callback.

protected filterEndDate(Carbon $current) : bool|string
Parameters
$current : Carbon
Return values
bool|string

filterRecurrences()

Recurrences filter callback (limits number of recurrences).

protected filterRecurrences(Carbon $current, int $key) : bool|string
Parameters
$current : Carbon
$key : int
Return values
bool|string

handleChangedParameters()

Handle change of the parameters.

protected handleChangedParameters() : mixed
Return values
mixed

incrementCurrentDateUntilValid()

Keep incrementing the current date until a valid date is found or the iteration is ended.

protected incrementCurrentDateUntilValid() : void
Tags
throws
RuntimeException
Return values
void

intervalHasTime()

Return whether given interval contains non zero value of any time unit.

protected static intervalHasTime(DateInterval $interval) : bool
Parameters
$interval : DateInterval
Return values
bool

isCarbonPredicateMethod()

Return whether given callable is a string pointing to one of Carbon's is* methods and should be automatically converted to a filter callback.

protected static isCarbonPredicateMethod(callable $callable) : bool
Parameters
$callable : callable
Return values
bool

isIso8601()

Return whether given variable is an ISO 8601 specification.

protected static isIso8601(mixed $var) : bool

Note: Check is very basic, as actual validation will be done later when parsing. We just want to ensure that variable is not any other type of a valid parameter.

Parameters
$var : mixed
Return values
bool

parseIso8601()

Parse given ISO 8601 string into an array of arguments.

protected static parseIso8601(string $iso) : array<string|int, mixed>
Parameters
$iso : string
Return values
array<string|int, mixed>

prepareForReturn()

Prepare given date to be returned to the external logic.

protected prepareForReturn(Carbon $date) : Carbon
Parameters
$date : Carbon
Return values
Carbon

updateInternalState()

Update properties after removing built-in filters.

protected updateInternalState() : void
Return values
void

validateCurrentDate()

Validate current date and stop iteration when necessary.

protected validateCurrentDate() : bool|string

Returns true when current date is valid, false if it is not, or static::END_ITERATION when iteration should be stopped.

Return values
bool|string

Search results