ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
BooleanTransformation.php
Go to the documentation of this file.
1<?php
2declare(strict_types=1);
3
4/* Copyright (c) 1998-2019 ILIAS open source, Extended GPL, see docs/LICENSE */
5
11
16
18{
20
24 public function transform($from)
25 {
26 if (false === is_bool($from)) {
28 'The value MUST be of type boolean',
29 'not_boolean'
30 );
31 }
32 return (bool) $from;
33 }
34
38 public function __invoke($from)
39 {
40 return $this->transform($from);
41 }
42}
An exception for terminatinating execution or to throw for unit testing.
__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.