ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
Transformation.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 2017 Stefan Hecken <stefan.hecken@concepts-and-training.de> Extended GPL, see docs/LICENSE */
3
5
8use ILIAS\Refinery\Transformation as TransformationInterface;
10
14class Transformation implements TransformationInterface
15{
17
21 protected $transform;
22 private $factory;
23
28 public function __construct(callable $transform, Factory $factory)
29 {
30 $this->transform = $transform;
31 $this->factory = $factory;
32 }
33
37 public function transform($from)
38 {
39 return call_user_func($this->transform, $from);
40 }
41
45 public function __invoke($from)
46 {
47 return $this->transform($from);
48 }
49}
An exception for terminatinating execution or to throw for unit testing.
Builds data types.
Definition: Factory.php:20
Transform values according to custom configuration.
__construct(callable $transform, Factory $factory)
__invoke($from)
Transformations should be callable.This MUST do the same as transform.InvalidArgumentException if the...
transform($from)
Perform the transformation.Please use this for transformations. It's more performant than calling inv...
A transformation is a function from one datatype to another.