ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Custom.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
7
11class Custom implements Transformation
12{
16 protected $transform;
17
21 public function __construct(callable $transform)
22 {
23 $this->transform = $transform;
24 }
25
29 public function transform($from)
30 {
31 return call_user_func($this->transform, $from);
32 }
33
37 public function __invoke($from)
38 {
39 return $this->transform($from);
40 }
41}
An exception for terminatinating execution or to throw for unit testing.
Transform values according to custom configuration.
Definition: Custom.php:12
transform($from)
Perform the transformation.Please use this for transformations. It's more performant than calling inv...
Definition: Custom.php:29
__invoke($from)
Transformations should be callable.This MUST do the same as transform.InvalidArgumentException if the...
Definition: Custom.php:37
A transformation is a function from one datatype to another.
$from