|
ILIAS
release_7 Revision v7.30-3-g800a261c036
|
A result encapsulates a value or an error and simplifies the handling of those. More...
Inheritance diagram for ILIAS\Data\Result\Ok:
Collaboration diagram for ILIAS\Data\Result\Ok:Public Member Functions | ||||||
| __construct ($value) | ||||||
| isOK () | ||||||
Get to know if the result is ok.
| ||||||
| value () | ||||||
Get the encapsulated value.
| ||||||
| isError () | ||||||
Get to know if the result is an error.
| ||||||
| error () | ||||||
Get the encapsulated error.
| ||||||
| valueOr ($default) | ||||||
Get the encapsulated value or the supplied default if result is an error.
| ||||||
| map (callable $f) | ||||||
Create a new result where the contained value is modified with $f.Does nothing if !isOK.
| ||||||
| then (callable $f) | ||||||
Get a new result from the callable or do nothing if this is an error.If null is returned from $f, the result is not touched.Does nothing if !isOK. This is monadic bind.
| ||||||
| except (callable $f) | ||||||
Feed the error into a callable and replace this with the result or do nothing if this is a value.If null is returned from $f, the error in the result is not touched.Does nothing if !isError.
| ||||||
| isOK () | ||||||
| Get to know if the result is ok. More... | ||||||
| value () | ||||||
| Get the encapsulated value. More... | ||||||
| isError () | ||||||
| Get to know if the result is an error. More... | ||||||
| error () | ||||||
| Get the encapsulated error. More... | ||||||
| valueOr ($default) | ||||||
| Get the encapsulated value or the supplied default if result is an error. More... | ||||||
| map (callable $f) | ||||||
| Create a new result where the contained value is modified with $f. More... | ||||||
| then (callable $f) | ||||||
| Get a new result from the callable or do nothing if this is an error. More... | ||||||
| except (callable $f) | ||||||
| Feed the error into a callable and replace this with the result or do nothing if this is a value. More... | ||||||
Protected Attributes | |
| $value | |
A result encapsulates a value or an error and simplifies the handling of those.
| ILIAS\Data\Result\Ok::__construct | ( | $value | ) |
Definition at line 21 of file Ok.php.
References ILIAS\Data\Result\Ok\$value, and ILIAS\Data\Result\Ok\value().
Here is the call graph for this function:| ILIAS\Data\Result\Ok::error | ( | ) |
Get the encapsulated error.
| LogicException | if isOK |
Implements ILIAS\Data\Result.
Definition at line 53 of file Ok.php.
| ILIAS\Data\Result\Ok::except | ( | callable | $f | ) |
Feed the error into a callable and replace this with the result or do nothing if this is a value.If null is returned from $f, the error in the result is not touched.Does nothing if !isError.
| callable | $f | string|\Exception -> Result|null |
| UnexpectedValueException | If callable returns no instance of Result |
Implements ILIAS\Data\Result.
Definition at line 98 of file Ok.php.
| ILIAS\Data\Result\Ok::isError | ( | ) |
Get to know if the result is an error.
Implements ILIAS\Data\Result.
Definition at line 45 of file Ok.php.
| ILIAS\Data\Result\Ok::isOK | ( | ) |
Get to know if the result is ok.
Implements ILIAS\Data\Result.
Definition at line 29 of file Ok.php.
| ILIAS\Data\Result\Ok::map | ( | callable | $f | ) |
Create a new result where the contained value is modified with $f.Does nothing if !isOK.
| callable | $f | mixed -> mixed |
Implements ILIAS\Data\Result.
Definition at line 69 of file Ok.php.
References Vendor\Package\$f, ILIAS\Data\Result\Ok\$value, and ILIAS\Data\Result\Ok\value().
Here is the call graph for this function:| ILIAS\Data\Result\Ok::then | ( | callable | $f | ) |
Get a new result from the callable or do nothing if this is an error.If null is returned from $f, the result is not touched.Does nothing if !isOK. This is monadic bind.
| callable | $f | mixed -> Result|null |
| UnexpectedValueException | If callable returns no instance of Result |
Implements ILIAS\Data\Result.
Definition at line 80 of file Ok.php.
References Vendor\Package\$f, $result, and ILIAS\Data\Result\Ok\value().
Here is the call graph for this function:| ILIAS\Data\Result\Ok::value | ( | ) |
Get the encapsulated value.
| Exception | if !isOK, will either throw the contained exception or a NotOKException if a string is contained as error. |
Implements ILIAS\Data\Result.
Definition at line 37 of file Ok.php.
References ILIAS\Data\Result\Ok\$value.
Referenced by ILIAS\Data\Result\Ok\__construct(), ILIAS\Data\Result\Ok\map(), and ILIAS\Data\Result\Ok\then().
Here is the caller graph for this function:| ILIAS\Data\Result\Ok::valueOr | ( | $default | ) |
Get the encapsulated value or the supplied default if result is an error.
| default |
Implements ILIAS\Data\Result.
Definition at line 61 of file Ok.php.
References ILIAS\Data\Result\Ok\$value.
|
protected |
Definition at line 19 of file Ok.php.
Referenced by ILIAS\Data\Result\Ok\__construct(), ILIAS\Data\Result\Ok\map(), ILIAS\Data\Result\Ok\value(), and ILIAS\Data\Result\Ok\valueOr().