class To extends Mutator (View source)

Convert the input to a given type,

Supports the following types:

  • int
  • float
  • bool
  • string
  • array
  • object

Traits

Methods

__construct(string $type)

No description

mixed
__invoke(mixed $value)

Mutate the input value.

from  Mutator
static To
array()

Convert the input to an array.

static To
bool()

Convert the input to a boolean.

static To
float()

Convert the input to a float.

static To
int()

Convert the input to an integer.

static To
make(string $type)

No description

mixed
mutate(mixed $value)

Mutate the input value.

static To
object()

Convert the input to an object.

string
resolveStringInput(mixed $value)

No description

static To
string()

Convert the input to a string.

Details

__construct(string $type)

No description

Parameters

string $type

The type to convert to.

Exceptions

InvalidArgumentException

final mixed __invoke(mixed $value)

Mutate the input value.

Parameters

mixed $value

Return Value

mixed

static To array()

Convert the input to an array.

Return Value

To

static To bool()

Convert the input to a boolean.

Return Value

To

static To float()

Convert the input to a float.

Return Value

To

static To int()

Convert the input to an integer.

Return Value

To

static To make(string $type)

No description

Parameters

string $type

The type to convert to.

Return Value

To

Exceptions

InvalidArgumentException

mixed mutate(mixed $value)

Mutate the input value.

Parameters

mixed $value

Return Value

mixed

static To object()

Convert the input to an object.

Return Value

To

protected string resolveStringInput(mixed $value)

No description

Parameters

mixed $value

Return Value

string

static To string()

Convert the input to a string.

Return Value

To