ToClass
class ToClass extends Mutator (View source)
Converts a value to a class instance using the given class' constructor.
If the value is already an instance of the given class, it will be returned as-is.
If the value is an array, it can be spread into the constructor by setting $spread
to true
.
Methods
__construct(string $class, bool $spread = false)
No description
mixed
mutate(mixed $value)
Mutate the input value.
Details
__construct(string $class, bool $spread = false)
No description
static ToClass
make(string $class, bool $spread = false)
No description
mixed
mutate(mixed $value)
Mutate the input value.