Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F56299033
Result.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
Result.php
View Options
<?php
namespace
Keruald\OmniTools\DataTypes\Result
;
abstract
class
Result
{
public
abstract
function
isOK
()
:
bool
;
public
abstract
function
isError
()
:
bool
;
public
abstract
function
getValue
()
:
mixed
;
public
abstract
function
map
(
callable
$callable
)
:
self
;
public
abstract
function
mapErr
(
callable
$callable
):
self
;
/**
* Returns the result if it is Ok,
* or the default result if an Err.
*
* @param mixed $default The default value
* @return mixed
*/
public
abstract
function
or
(
Result
$default
)
:
self
;
/**
* Returns the result if it is Ok,
* otherwise calls the callable and returns the new result.
*
* The callable is called only on Err, allowing lazy evaluation.
* The callable must return a Result.
*/
public
abstract
function
orElse
(
callable
$callable
)
:
self
;
/**
* Returns the value of the result if it is Ok,
* or the default value if the option is Err.
*
* @param mixed $default The default value
* @return mixed
*/
public
abstract
function
getValueOr
(
mixed
$default
)
:
mixed
;
/**
* Returns the value of the result if it is Ok,
* or the result of the callable if the option is Err.
*
* The callable is called only on Err, allowing lazy evaluation.
*
* @param callable $callable A function that returns a default value.
* @return mixed
*/
public
abstract
function
getValueOrElse
(
callable
$callable
)
:
mixed
;
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Fri, Nov 6, 19:03 (2 d, 17 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4224874
Default Alt Text
Result.php (1 KB)
Attached To
Mode
rKOT Keruald OmniTools
Attached
Detach File
Event Timeline
Log In to Comment