ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
DeriveApplyToFromTransform.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2019 ILIAS open source, Extended GPL, see docs/LICENSE */
3
8namespace ILIAS\Refinery;
9
11
13{
19 abstract public function transform($from);
20
25 public function applyTo(Result $result) : Result
26 {
27 try {
28 $value = $this->transform($result->value());
29 } catch (\Exception $exception) {
30 return new Result\Error($exception);
31 }
32
33 return new Result\Ok($value);
34 }
35}
$result
An exception for terminatinating execution or to throw for unit testing.
A result encapsulates a value or an error and simplifies the handling of those.
Definition: Result.php:12