ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
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 
8 namespace 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 }
value()
Get the encapsulated value.
$result
A result encapsulates a value or an error and simplifies the handling of those.
Definition: Result.php:11