Result
class Result implements Stringable, Traversable, Countable, ArrayAccess, IteratorAggregate (View source)
Result class.
Properties
protected | $attributes |
Methods
Result constructor.
Returns error messages.
Adds an attribute to the result object.
Countable::count()
interface implementation.
Returns a property or an attribute from the result object.
Returns the attributes (any additional variables) of the result object.
Returns the errors of the result object.
IteratorAggregate::getIterator()
interface implementation.
Returns the metadata of the result object.
Returns the final result of the result object.
Returns the validations of the result object.
Returns the value of the result object.
ArrayAccess::offsetExists()
interface implementation.
ArrayAccess::offsetGet()
interface implementation.
ArrayAccess::offsetSet()
interface implementation.
ArrayAccess::offsetUnset()
interface implementation.
Removes an attribute from the result object.
Returns the result object as an array including the attributes.
Returns the result object as a string (formatted error message or an empty string if there wasn't any errors).
Details
__construct(mixed $value, bool $result, array $validations, array $errors, array $metadata)
Result constructor.
string
__toString()
Returns error messages.
Result
addAttribute(string $name, mixed $value)
Adds an attribute to the result object.
int
count()
Countable::count()
interface implementation.
{@inheritDoc}
static Result
from(array $data)
Result factory method.
mixed
getAttribute(string $name, mixed $default = null)
Returns a property or an attribute from the result object.
array
getAttributes()
Returns the attributes (any additional variables) of the result object.
array
getErrors()
Returns the errors of the result object.
Traversable
getIterator()
IteratorAggregate::getIterator()
interface implementation.
array
getMetadata()
Returns the metadata of the result object.
bool
getResult()
Returns the final result of the result object.
array
getValidations()
Returns the validations of the result object.
mixed
getValue()
Returns the value of the result object.
bool
offsetExists(mixed $offset)
ArrayAccess::offsetExists()
interface implementation.
{@inheritDoc}
mixed
offsetGet(mixed $offset)
ArrayAccess::offsetGet()
interface implementation.
{@inheritDoc}
void
offsetSet(mixed $offset, mixed $value)
ArrayAccess::offsetSet()
interface implementation.
{@inheritDoc}
void
offsetUnset(mixed $offset)
ArrayAccess::offsetUnset()
interface implementation.
{@inheritDoc}
Result
removeAttribute(string $name)
Removes an attribute from the result object.
array
toArray()
Returns the result object as an array including the attributes.
string
toString()
Returns the result object as a string (formatted error message or an empty string if there wasn't any errors).