Documentation

DynamicTypeCaster Uses HasAttributes, ForwardsCalls

DynamicTypeCaster

Tags
mixin

Model

Table of Contents

$dataType  : DataType|null
$key  : string|null
$model  : DynamicallyCastsTypes|null
$modelAttributes  : array<string|int, mixed>
$value  : mixed
__call()  : mixed
Forwards calls to Model, handles get and set methods from HasAttributes.
__construct()  : mixed
DynamicTypeCaster.
get()  : mixed
getCastedAttribute()  : mixed
Cast attribute from string to @DataType.
newInstance()  : self
New DynamicTypeCaster instance.
set()  : mixed
setCastedAttribute()  : string|null
Cast attribute from @DataType to string.
setDataType()  : $this
Set the @DataType.
setKey()  : $this
Set the key.
setModel()  : $this
Set the model.
setModelAttributes()  : $this
Set the model attributes.
setValue()  : $this
Set the value to be cast.
updateCasts()  : $this
Update the casts array.
validateInstance()  : bool
Is this instance valid?

Properties

Methods

__call()

Forwards calls to Model, handles get and set methods from HasAttributes.

public __call(string $name, array<string|int, mixed> $arguments) : mixed
Parameters
$name : string
$arguments : array<string|int, mixed>
Return values
mixed

__construct()

DynamicTypeCaster.

public __construct([DynamicallyCastsTypes|null $model = null ][, string|null $key = null ][, mixed $value = null ][, array<string|int, mixed> $modelAttributes = [] ][, DataType|null $dataType = null ]) : mixed
Parameters
$model : DynamicallyCastsTypes|null = null
$key : string|null = null
$value : mixed = null
$modelAttributes : array<string|int, mixed> = []
$dataType : DataType|null = null
Return values
mixed

getCastedAttribute()

Cast attribute from string to @DataType.

public getCastedAttribute() : mixed
Return values
mixed

newInstance()

New DynamicTypeCaster instance.

public newInstance(DynamicallyCastsTypes $model, string $key, mixed $value, array<string|int, mixed> $modelAttributes) : self
Parameters
$model : DynamicallyCastsTypes
$key : string
$value : mixed
$modelAttributes : array<string|int, mixed>
Return values
self

setCastedAttribute()

Cast attribute from @DataType to string.

public setCastedAttribute() : string|null
Return values
string|null

setKey()

Set the key.

public setKey(string $key) : $this
Parameters
$key : string
Return values
$this

setModelAttributes()

Set the model attributes.

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

setValue()

Set the value to be cast.

public setValue(mixed $value) : $this
Parameters
$value : mixed
Return values
$this

updateCasts()

Update the casts array.

public updateCasts([string|null $key = null ][, DataType|null $dataType = null ]) : $this
Parameters
$key : string|null = null
$dataType : DataType|null = null
Return values
$this

validateInstance()

Is this instance valid?

public validateInstance() : bool
Return values
bool

Search results