FileAccess Orion

Mixin

Trait Boundaries.

startOf, endOf and derived method for each unit.

Depends on the following properties:

Table of Contents

$daysInMonth  : int
$month  : int
$quarter  : int
$year  : int
$macroContextStack  : array<string|int, mixed>
Stack of macro instance contexts.
addMonths()  : $this
mixin()  : void
Mix another object into the class.
setDate()  : $this
setTime()  : $this
bindMacroContext()  : mixed
Stack a Carbon context from inside calls of self::this() and execute a given action.
this()  : static
Return the current context from inside a macro callee or a new one if static.
loadMixinClass()  : mixed
loadMixinTrait()  : mixed

Properties

$daysInMonth

public int $daysInMonth

$quarter

public int $quarter

Depends on the following methods:

$macroContextStack

Stack of macro instance contexts.

protected static array<string|int, mixed> $macroContextStack = []

Methods

addMonths()

public addMonths(int $value = 1) : $this
Parameters
$value = 1 : int
Return values
$this

mixin()

Mix another object into the class.

public static mixin(object|string $mixin) : void
Parameters
$mixin : object|string
Tags
example
Carbon::mixin(new class {
  public function addMoon() {
    return function () {
      return $this->addDays(30);
    };
  }
  public function subMoon() {
    return function () {
      return $this->subDays(30);
    };
  }
});
$fullMoon = Carbon::create('2018-12-22');
$nextFullMoon = $fullMoon->addMoon();
$blackMoon = Carbon::create('2019-01-06');
$previousBlackMoon = $blackMoon->subMoon();
echo "$nextFullMoon\n";
echo "$previousBlackMoon\n";
throws
ReflectionException
Return values
void

setDate()

public setDate(int $year, int $month, int $day) : $this
Parameters
$year : int
$month : int
$day : int
Return values
$this

setTime()

public setTime(int $hour, int $minute, int $second = 0, int $microseconds = 0) : $this
Parameters
$hour : int
$minute : int
$second = 0 : int
$microseconds = 0 : int
Return values
$this

bindMacroContext()

Stack a Carbon context from inside calls of self::this() and execute a given action.

protected static bindMacroContext(static|null $context, callable $callable) : mixed
Parameters
$context : static|null
$callable : callable
Tags
throws
Throwable
Return values
mixed

this()

Return the current context from inside a macro callee or a new one if static.

protected static this() : static
Return values
static

loadMixinClass()

private static loadMixinClass(string $mixin) : mixed
Parameters
$mixin : string
Tags
throws
ReflectionException
Return values
mixed

loadMixinTrait()

private static loadMixinTrait(string $trait) : mixed
Parameters
$trait : string
Return values
mixed

Search results