0 follower

Final Class Yiisoft\Hydrator\Result

InheritanceYiisoft\Hydrator\Result

The result object that provides whether the value is resolved or not, and the value itself.

Public Methods

Hide inherited methods

Method Description Defined By
fail() Creates instance of Result without value. Yiisoft\Hydrator\Result
getValue() Returns the resolved value. Yiisoft\Hydrator\Result
isResolved() Yiisoft\Hydrator\Result
success() Creates instance of Result with resolved value. Yiisoft\Hydrator\Result

Method Details

Hide inherited methods

fail() public static method

Creates instance of Result without value.

public static self fail ( )
return self

The result object.

                public static function fail(): self
{
    return new self(false);
}

            
getValue() public method

Returns the resolved value.

When the value is not resolved, this method returns null. Since null can be a valid value as well, please use {@see \Yiisoft\Hydrator\isResolved()} to check if the value is resolved or not.

public mixed getValue ( )
return mixed

The resolved value.

                public function getValue(): mixed
{
    return $this->value;
}

            
isResolved() public method

public boolean isResolved ( )
return boolean

Whether the value is resolved.

                public function isResolved(): bool
{
    return $this->isResolved;
}

            
success() public static method

Creates instance of Result with resolved value.

public static self success ( mixed $value )
$value mixed

The resolved value.

return self

The result object.

                public static function success(mixed $value): self
{
    return new self(true, $value);
}