ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ILIAS\Transformation\Factory Class Reference

Factory for basic transformations. More...

+ Collaboration diagram for ILIAS\Transformation\Factory:

Public Member Functions

 addLabels (array $labels)
 Add labels to an array. More...
 
 splitString ($delimiter)
 Split string at given delimiter. More...
 
 custom (callable $f)
 Create a custom transformation. More...
 
 toData ($type)
 Transform primitive value to data-type. More...
 

Detailed Description

Factory for basic transformations.

For purpose and usage see README.md

Definition at line 11 of file Factory.php.

Member Function Documentation

◆ addLabels()

ILIAS\Transformation\Factory::addLabels ( array  $labels)

Add labels to an array.

Will transform ["a","b"] to ["A" => "a", "B" => "b"] with $labels = ["A", "B"].

Parameters
string[]$labels
Returns
Transformation

Definition at line 21 of file Factory.php.

22  {
23  return new Transformations\AddLabels($labels);
24  }

◆ custom()

ILIAS\Transformation\Factory::custom ( callable  $f)

Create a custom transformation.

Parameters
callable$fmixed -> mixed
Returns
Transformation

Definition at line 45 of file Factory.php.

46  {
47  return new Transformations\Custom($f);
48  }

◆ splitString()

ILIAS\Transformation\Factory::splitString (   $delimiter)

Split string at given delimiter.

Will transform "a,b,c" to ["a", "b", "c"] with $delim = ",".

Parameters
string$delimiter
Returns
Transformation

Definition at line 34 of file Factory.php.

References $delimiter.

35  {
36  return new Transformations\SplitString($delimiter);
37  }
$delimiter
Definition: showstats.php:16

◆ toData()

ILIAS\Transformation\Factory::toData (   $type)

Transform primitive value to data-type.

Parameters
string$type
Returns
Transformation

Definition at line 56 of file Factory.php.

References $type.

57  {
58  return new Transformations\Data($type);
59  }
$type

The documentation for this class was generated from the following file: