| 
    ILIAS
    release_10 Revision v10.1-43-ga1241a92c2f
    
   | 
  
A result encapsulates a value or an error and simplifies the handling of those. More...
 Inheritance diagram for ILIAS\Data\Result\Error:
 Collaboration diagram for ILIAS\Data\Result\Error:Public Member Functions | ||||||
| __construct ($error) | ||||||
| isOK () | ||||||
| Get to know if the result is ok.  More... | ||||||
| value () | ||||||
Get the encapsulated value.
 
  | ||||||
| isError () | ||||||
| Get to know if the result is an error.  More... | ||||||
| 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.
 
  | ||||||
Protected Attributes | |
| $error | |
A result encapsulates a value or an error and simplifies the handling of those.
| ILIAS\Data\Result\Error::__construct | ( | $error | ) | 
Definition at line 24 of file Error.php.
References ILIAS\Data\Result\Error\$error, and ILIAS\Data\Result\Error\error().
 Here is the call graph for this function:| ILIAS\Data\Result\Error::error | ( | ) | 
Get the encapsulated error.
Implements ILIAS\Data\Result.
Definition at line 63 of file Error.php.
References ILIAS\Data\Result\Error\$error.
Referenced by ILIAS\Data\Result\Error\__construct(), ILIAS\Data\Result\Error\except(), and ILIAS\Data\Result\Error\value().
 Here is the caller graph for this function:| ILIAS\Data\Result\Error::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| -> Result|null | 
Implements ILIAS\Data\Result.
Definition at line 95 of file Error.php.
References Vendor\Package\$f, and ILIAS\Data\Result\Error\error().
 Here is the call graph for this function:| ILIAS\Data\Result\Error::isError | ( | ) | 
Get to know if the result is an error.
Implements ILIAS\Data\Result.
| ILIAS\Data\Result\Error::isOK | ( | ) | 
Get to know if the result is ok.
Implements ILIAS\Data\Result.
| ILIAS\Data\Result\Error::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.
| ILIAS\Data\Result\Error::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 | 
Implements ILIAS\Data\Result.
| ILIAS\Data\Result\Error::value | ( | ) | 
Get the encapsulated value.
Implements ILIAS\Data\Result.
Definition at line 43 of file Error.php.
References ILIAS\Data\Result\Error\$error, and ILIAS\Data\Result\Error\error().
 Here is the call graph for this function:| ILIAS\Data\Result\Error::valueOr | ( | $default | ) | 
Get the encapsulated value or the supplied default if result is an error.
| mixed | $default | 
Implements ILIAS\Data\Result.
      
  | 
  protected | 
Definition at line 22 of file Error.php.
Referenced by ILIAS\Data\Result\Error\__construct(), ILIAS\Data\Result\Error\error(), and ILIAS\Data\Result\Error\value().