ILIAS
release_5-4 Revision v5.4.26-12-gabc799a52e6
◀ ilDoc Overview
Data.php
Go to the documentation of this file.
1
<?
php
2
/* Copyright (c) 2018 Nils Haagen <nils.haagen@concepts-and-training.de> Extended GPL, see docs/LICENSE */
3
4
namespace
ILIAS\Transformation\Transformations
;
5
6
use
ILIAS\Transformation\Transformation
;
7
use
ILIAS\Data\Factory
as
DataFactory
;
8
12
class
Data
implements
Transformation
13
{
17
protected
$type
;
18
22
protected
$value
;
23
27
public
function
__construct
(
$type
)
28
{
29
$this->type =
$type
;
30
if
(!method_exists($this->
getDataFactory
(),
$type
)) {
31
throw
new \InvalidArgumentException(
"No such type to transform to: $type"
);
32
}
33
}
34
38
public
function
transform
(
$from
)
39
{
40
$type
=
$this->type
;
41
$data_factory = $this->
getDataFactory
();
42
return
$data_factory->$type(
$from
);
43
}
44
48
public
function
__invoke
(
$from
)
49
{
50
return
$this->
transform
(
$from
);
51
}
52
57
protected
function
getDataFactory
()
58
{
59
return
new
DataFactory
();
60
}
61
}
ILIAS\Transformation\Transformations\Data\$type
$type
Definition:
Data.php:17
ILIAS\Transformation\Transformations\Data\transform
transform($from)
Perform the transformation.Please use this for transformations. It's more performant than calling inv...
Definition:
Data.php:38
ILIAS\Transformation\Transformation
A transformation is a function from one datatype to another.
Definition:
Transformation.php:15
ILIAS\Transformation\Transformations\Data\__construct
__construct($type)
Definition:
Data.php:27
$from
$from
Definition:
logout-iframe.php:5
ILIAS\Transformation\Transformations
Definition:
AddLabels.php:4
ILIAS\Transformation\Transformations\Data\__invoke
__invoke($from)
Transformations should be callable.This MUST do the same as transform.
Definition:
Data.php:48
ILIAS\Transformation\Transformations\Data
Convert a primitive to a data type.
Definition:
Data.php:12
Factory
ILIAS\Transformation\Transformations\Data\getDataFactory
getDataFactory()
Get an instance of the data-factory.
Definition:
Data.php:57
ILIAS\Transformation\Transformations\Data\$value
$value
Definition:
Data.php:22
Transformation
php
src
Transformation
Transformations
Data.php
Generated on Thu Jan 16 2025 19:02:37 for ILIAS by
1.8.13 (using
Doxyfile
)