Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F14039180
Err.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
Err.php
View Options
<?php
namespace
Keruald\OmniTools\DataTypes\Result
;
use
Exception
;
use
InvalidArgumentException
;
use
Throwable
;
class
Err
extends
Result
{
private
?
Throwable
$error
;
public
function
__construct
(
Throwable
$error
=
null
)
{
$this
->
error
=
$error
;
}
public
function
isOK
()
:
false
{
return
false
;
}
public
function
isError
()
:
true
{
return
true
;
}
public
function
getValue
()
:
mixed
{
throw
new
InvalidArgumentException
(
<<<'EOD'
This result is an error, so it doesn't have a value.
You can check first with isOK() if this is a value.
Or if you want the error, use getError().
EOD
);
}
public
function
getError
()
:
Throwable
{
return
$this
->
error
;
}
public
function
setError
(
Throwable
$error
)
:
void
{
$this
->
error
=
$error
;
}
public
function
map
(
callable
$callable
)
:
self
{
return
$this
;
}
public
function
mapErr
(
callable
$callable
)
:
self
{
$error
=
$callable
(
$this
->
error
);
return
new
self
(
$error
);
}
public
function
orElse
(
mixed
$default
)
:
mixed
{
return
$default
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Fri, Nov 28, 17:34 (17 h, 38 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3150682
Default Alt Text
Err.php (1 KB)
Attached To
Mode
rKERUALD Keruald libraries development repository
Attached
Detach File
Event Timeline
Log In to Comment