ILIAS  release_7 Revision v7.30-3-g800a261c036
NullTransformation.php
Go to the documentation of this file.
1<?php declare(strict_types=1);
2
3/* Copyright (c) 2020 Nils Haagen <nils.haagen@concepts-and-training.de>, Extended GPL, see docs/LICENSE */
4
6
11
13{
16
20 public function transform($from)
21 {
22 if (is_null($from)) {
23 return null;
24 }
25 if (is_string($from) && trim($from) === '') {
26 return null;
27 }
29 sprintf('The value "%s" could not be transformed into null', var_export($from, true)),
30 'not_null',
31 $from
32 );
33 }
34}
An exception for terminatinating execution or to throw for unit testing.
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.