IntervalStep
Table of Contents
Properties
- $step : Closure|null
- Step to apply instead of a fixed interval to get the new date.
Methods
- convertDate() : CarbonInterface
- Take a date and apply either the step if set, or the current interval else.
- getStep() : Closure
- Get the dynamic step in use.
- setStep() : void
- Set a step to apply instead of a fixed interval to get the new date.
- resolveCarbon() : Carbon|CarbonImmutable
- Convert DateTimeImmutable instance to CarbonImmutable instance and DateTime instance to Carbon instance.
Properties
$step
Step to apply instead of a fixed interval to get the new date.
protected
Closure|null
$step
Methods
convertDate()
Take a date and apply either the step if set, or the current interval else.
public
convertDate(DateTimeInterface $dateTime[, bool $negated = false ]) : CarbonInterface
The interval/step is applied negatively (typically subtraction instead of addition) if $negated is true.
Parameters
- $dateTime : DateTimeInterface
- $negated : bool = false
Return values
CarbonInterfacegetStep()
Get the dynamic step in use.
public
getStep() : Closure
Return values
ClosuresetStep()
Set a step to apply instead of a fixed interval to get the new date.
public
setStep(Closure|null $step) : void
Or pass null to switch to fixed interval.
Parameters
- $step : Closure|null
resolveCarbon()
Convert DateTimeImmutable instance to CarbonImmutable instance and DateTime instance to Carbon instance.
private
resolveCarbon(DateTimeInterface $dateTime) : Carbon|CarbonImmutable
Parameters
- $dateTime : DateTimeInterface