ILIAS
release_7 Revision v7.30-3-g800a261c036
◀ ilDoc Overview
IntegerTransformation.php
Go to the documentation of this file.
1
<?php
2
declare(strict_types=1);
3
4
/* Copyright (c) 1998-2019 ILIAS open source, Extended GPL, see docs/LICENSE */
5
10
namespace
ILIAS\Refinery\To\Transformation
;
11
12
use
ILIAS\Refinery\DeriveApplyToFromTransform
;
13
use
ILIAS\Refinery\Transformation
;
14
use
ILIAS\Refinery\ConstraintViolationException
;
15
use
ILIAS\Refinery\DeriveInvokeFromTransform
;
16
17
class
IntegerTransformation
implements
Transformation
18
{
19
use
DeriveApplyToFromTransform
;
20
use
DeriveInvokeFromTransform
;
21
25
public
function
transform
($from)
26
{
27
if
(
false
=== is_int($from)) {
28
throw
new
ConstraintViolationException
(
29
'The value MUST be of type integer'
,
30
'not_integer'
31
);
32
}
33
return
(
int
) $from;
34
}
35
}
Transformation
ILIAS\Refinery\DeriveApplyToFromTransform
trait DeriveApplyToFromTransform
Definition:
DeriveApplyToFromTransform.php:13
ILIAS\Refinery\To\Transformation
Definition:
BooleanTransformation.php:10
ILIAS\Refinery\DeriveInvokeFromTransform
trait DeriveInvokeFromTransform
Definition:
DeriveInvokeFromTransform.php:13
ILIAS\Refinery\To\Transformation\IntegerTransformation\transform
transform($from)
Perform the transformation.Please use this for transformations. It's more performant than calling inv...
Definition:
IntegerTransformation.php:25
ILIAS\Refinery\ConstraintViolationException
Definition:
ConstraintViolationException.php:14
ILIAS\Refinery\To\Transformation\IntegerTransformation
Definition:
IntegerTransformation.php:17
ILIAS\Refinery\Transformation
A transformation is a function from one datatype to another.
Definition:
Transformation.php:17
ConstraintViolationException
src
Refinery
To
Transformation
IntegerTransformation.php
Generated on Wed Sep 3 2025 21:01:45 for ILIAS by
1.8.13 (using
Doxyfile
)