trait Mutability

Trait Mutability.

Utils to know if the current object is mutable or immutable and convert it.

Traits

Trait Cast.

Methods

cast(string$className)

Cast the current instance into the given class.

from Cast
static bool
isMutable()

Returns true if the current class/instance is mutable.

static bool
isImmutable()

Returns true if the current class/instance is immutable.

toMutable()

Return a mutable copy of the instance.

toImmutable()

Return a immutable copy of the instance.

Details

inCastat line31
DateTimeInterface cast(string$className)

Cast the current instance into the given class.

Parameters

string $className The $className::instance() method will be called to cast the current object.

Return Value

DateTimeInterface

at line31
staticbool isMutable()

Returns true if the current class/instance is mutable.

Return Value

bool

at line41
staticbool isImmutable()

Returns true if the current class/instance is immutable.

Return Value

bool

at line51
Carbon toMutable()

Return a mutable copy of the instance.

Return Value

Carbon

at line64
CarbonImmutable toImmutable()

Return a immutable copy of the instance.

Return Value

CarbonImmutable