ILIAS
release_5-4 Revision v5.4.26-12-gabc799a52e6
◀ ilDoc Overview
SplitString.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
4
namespace
ILIAS\Transformation\Transformations
;
5
6
use
ILIAS\Transformation\Transformation
;
7
11
class
SplitString
implements
Transformation
12
{
16
protected
$delimiter
;
17
21
public
function
__construct
(
$delimiter
)
22
{
23
$this->delimiter =
$delimiter
;
24
}
25
29
public
function
transform
(
$from
)
30
{
31
if
(!is_string(
$from
)) {
32
throw
new \InvalidArgumentException(__METHOD__ .
" the argument is not a string."
);
33
}
34
35
return
explode($this->delimiter,
$from
);
36
}
37
41
public
function
__invoke
(
$from
)
42
{
43
return
$this->
transform
(
$from
);
44
}
45
}
ILIAS\Transformation\Transformations\SplitString\$delimiter
$delimiter
Definition:
SplitString.php:16
ILIAS\Transformation\Transformation
A transformation is a function from one datatype to another.
Definition:
Transformation.php:15
ILIAS\Transformation\Transformations\SplitString\__invoke
__invoke($from)
Transformations should be callable.This MUST do the same as transform.
Definition:
SplitString.php:41
$from
$from
Definition:
logout-iframe.php:5
ILIAS\Transformation\Transformations\SplitString\__construct
__construct($delimiter)
Definition:
SplitString.php:21
ILIAS\Transformation\Transformations
Definition:
AddLabels.php:4
Transformation
ILIAS\Transformation\Transformations\SplitString\transform
transform($from)
Perform the transformation.Please use this for transformations. It's more performant than calling inv...
Definition:
SplitString.php:29
ILIAS\Transformation\Transformations\SplitString
Split a string by delimiter into array.
Definition:
SplitString.php:11
php
src
Transformation
Transformations
SplitString.php
Generated on Thu Feb 27 2025 19:02:11 for ILIAS by
1.8.13 (using
Doxyfile
)