ILIAS
trunk Revision v11.0_alpha-2662-g519ff7d528f
◀ ilDoc Overview
DeriveTransformFromApplyTo.php
Go to the documentation of this file.
1
<?php
2
19
declare(strict_types=1);
20
21
namespace
ILIAS\Refinery
;
22
23
use
ILIAS\Data\Result
;
24
use
Exception
;
25
26
trait
DeriveTransformFromApplyTo
27
{
31
abstract
public
function
applyTo
(
Result
$result):
Result
;
32
36
public
function
transform
($from)
37
{
39
$result = $this->
applyTo
(
new
Result
\
Ok
($from));
40
if
(
true
=== $result->
isError
()) {
41
$error
= $result->
error
();
42
43
if
(
$error
instanceof
Exception
) {
44
throw
$error
;
45
}
46
47
throw
new
Exception(
$error
);
48
}
49
return
$result->
value
();
50
}
51
}
ILIAS\Refinery\transform
transform($from)
Definition:
DeriveTransformWithProblem.php:36
ILIAS\Refinery\applyTo
applyTo(Result $result)
Definition:
DeriveApplyToFromTransform.php:38
ILIAS\Data\Result\value
value()
Get the encapsulated value.
ILIAS\Data\Result
Definition:
Error.php:21
ILIAS\Refinery
Definition:
ByTrying.php:21
ILIAS\Data\Result\isError
isError()
Get to know if the result is an error.
ILIAS\Data\Result\Ok
A result encapsulates a value or an error and simplifies the handling of those.
Definition:
Ok.php:30
ILIAS\Data\Result\error
error()
Get the encapsulated error.
DeriveTransformFromApplyTo
ILIAS\$error
ilErrorHandling $error
Definition:
class.ilias.php:69
WrapperInterface
Exception
components
ILIAS
Refinery
src
DeriveTransformFromApplyTo.php
Generated on Wed Sep 3 2025 23:03:37 for ILIAS by
1.8.13 (using
Doxyfile
)