ILIAS
trunk Revision v11.0_alpha-2638-g80c1d007f79
◀ ilDoc Overview
DeriveApplyToFromTransform.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
ILIAS\Data\Result\Ok
;
25
use
ILIAS\Data\Result\Error
;
26
use
Exception
;
27
28
trait
DeriveApplyToFromTransform
29
{
33
abstract
public
function
transform
($from);
34
38
public
function
applyTo
(
Result
$result):
Result
39
{
40
return
$result->
then
(
function
($value):
Result
{
41
try
{
42
return
new
Ok
($this->
transform
($value));
43
}
catch
(
Exception
$exception) {
44
return
new
Error
($exception);
45
}
46
});
47
}
48
}
ILIAS\Data\Result\then
then(callable $f)
Get a new result from the callable or do nothing if this is an error.
ILIAS\Refinery\transform
transform($from)
Definition:
DeriveTransformWithProblem.php:36
ILIAS\Refinery\applyTo
applyTo(Result $result)
Definition:
DeriveApplyToFromTransform.php:38
ILIAS\Data\Result
Definition:
Error.php:21
ILIAS\Refinery
Definition:
ByTrying.php:21
ILIAS\MetaData\OERExposer\OAIPMH\Responses\Error
Error
Definition:
Error.php:23
ILIAS\Data\Result\Ok
A result encapsulates a value or an error and simplifies the handling of those.
Definition:
Ok.php:30
Ok
WrapperInterface
DeriveApplyToFromTransform
Exception
components
ILIAS
Refinery
src
DeriveApplyToFromTransform.php
Generated on Sun Aug 31 2025 23:03:31 for ILIAS by
1.8.13 (using
Doxyfile
)