ILIAS  trunk Revision v11.0_alpha-2645-g16283d3b3f8
ILIAS\Refinery\To\Group Class Reference
+ Collaboration diagram for ILIAS\Refinery\To\Group:

Public Member Functions

 __construct (private readonly Factory $dataFactory, private readonly Language $language)
 
 string ()
 Returns an object that allows to transform a value to a string value. More...
 
 int ()
 Returns an object that allows to transform a value to an integer value. More...
 
 float ()
 Returns an object that allows to transform a value to a float value. More...
 
 bool ()
 Returns an object that allows to transform a value to a boolean value. More...
 
 listOf (Transformation $transformation)
 Returns an object that allows to transform an value in a given array with the given transformation object. More...
 
 dictOf (Transformation $transformation)
 Returns an object that allows to transform the values of an associative array with the given transformation object. More...
 
 tupleOf (array $transformation)
 Returns an object that allows to transform the values of an array with the given array of transformations objects. More...
 
 recordOf (array $transformations)
 Returns an object that allows to transform the values of an associative array with the given associative array of transformations objects. More...
 
 toNew ($classNameOrArray)
 Returns either an transformation object to create objects of an existing class, with variations of constructor parameters OR returns an transformation object to execute a certain method with variation of parameters on the objects. More...
 
 data (string $dataType)
 
 dateTime ()
 
 inArray (array $valid_members)
 Validates that the value to be transformed is in the set given to this transformation. More...
 

Detailed Description

Definition at line 40 of file Group.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Refinery\To\Group::__construct ( private readonly Factory  $dataFactory,
private readonly Language  $language 
)

Definition at line 42 of file Group.php.

45  {
46  }

Member Function Documentation

◆ bool()

ILIAS\Refinery\To\Group::bool ( )

Returns an object that allows to transform a value to a boolean value.

Definition at line 79 of file Group.php.

79  : Transformation
80  {
81  return new BooleanTransformation();
82  }

◆ data()

ILIAS\Refinery\To\Group::data ( string  $dataType)
Parameters
string$dataType- Name of the data type, this value MUST much with the methods provided by the \ILIAS\Data\Factory
Returns
Transformation

Definition at line 174 of file Group.php.

References ILIAS\Refinery\To\Group\toNew().

174  : Transformation
175  {
176  return $this->toNew([$this->dataFactory, $dataType]);
177  }
toNew($classNameOrArray)
Returns either an transformation object to create objects of an existing class, with variations of co...
Definition: Group.php:158
+ Here is the call graph for this function:

◆ dateTime()

ILIAS\Refinery\To\Group::dateTime ( )

Definition at line 179 of file Group.php.

179  : Transformation
180  {
181  return new DateTimeTransformation();
182  }

◆ dictOf()

ILIAS\Refinery\To\Group::dictOf ( Transformation  $transformation)

Returns an object that allows to transform the values of an associative array with the given transformation object.

The keys of an associative array MUST be of type String

Using ILIAS\Refinery\Factory::to() will check if the value is identical to the value after the transformation.

Definition at line 105 of file Group.php.

105  : Transformation
106  {
107  return new DictionaryTransformation($transformation);
108  }

◆ float()

ILIAS\Refinery\To\Group::float ( )

Returns an object that allows to transform a value to a float value.

Definition at line 70 of file Group.php.

70  : Transformation
71  {
72  return new FloatTransformation();
73  }

◆ inArray()

ILIAS\Refinery\To\Group::inArray ( array  $valid_members)

Validates that the value to be transformed is in the set given to this transformation.

There is no constraint on the type of the elements in the set.

list

Returns
Transformation<A, A>

Definition at line 191 of file Group.php.

References ILIAS\UI\examples\Symbol\Glyph\Language\language().

191  : Transformation
192  {
193  return new InArrayTransformation($valid_members, $this->language);
194  }
language()
description: > Example for rendring a language glyph.
Definition: language.php:41
+ Here is the call graph for this function:

◆ int()

ILIAS\Refinery\To\Group::int ( )

Returns an object that allows to transform a value to an integer value.

Definition at line 61 of file Group.php.

61  : Transformation
62  {
63  return new IntegerTransformation();
64  }

◆ listOf()

ILIAS\Refinery\To\Group::listOf ( Transformation  $transformation)

Returns an object that allows to transform an value in a given array with the given transformation object.

The transformation will be executed on every element of the array.

Using ILIAS\Refinery\Factory::to() will check if the value is identical to the value after the transformation.

Definition at line 92 of file Group.php.

92  : Transformation
93  {
94  return new ListTransformation($transformation);
95  }

◆ recordOf()

ILIAS\Refinery\To\Group::recordOf ( array  $transformations)

Returns an object that allows to transform the values of an associative array with the given associative array of transformations objects.

The length of the array of transformations MUST be identical to the array of values to transform. The keys of the transformation array will be the same as the key from the value array e.g. Transformation with the key "hello" will transform value with the key "hello" of the value array.

Using ILIAS\Refinery\Factory::to() will check if the value is identical to the value after the transformation.

Parameters
array<string,Transformation>$transformations
Returns
Transformation

Definition at line 145 of file Group.php.

145  : Transformation
146  {
147  return new RecordTransformation($transformations);
148  }

◆ string()

ILIAS\Refinery\To\Group::string ( )

Returns an object that allows to transform a value to a string value.

Definition at line 52 of file Group.php.

52  : Transformation
53  {
54  return new StringTransformation();
55  }

◆ toNew()

ILIAS\Refinery\To\Group::toNew (   $classNameOrArray)

Returns either an transformation object to create objects of an existing class, with variations of constructor parameters OR returns an transformation object to execute a certain method with variation of parameters on the objects.

Parameters
string|array{0object, 1: string} $classNameOrArray
Returns
Transformation

Definition at line 158 of file Group.php.

Referenced by ILIAS\Refinery\To\Group\data().

158  : Transformation
159  {
160  if (is_array($classNameOrArray)) {
161  if (2 !== count($classNameOrArray)) {
162  throw new InvalidArgumentException('The array MUST contain exactly two elements');
163  }
164  return new NewMethodTransformation($classNameOrArray[0], $classNameOrArray[1]);
165  }
166  return new NewObjectTransformation($classNameOrArray);
167  }
+ Here is the caller graph for this function:

◆ tupleOf()

ILIAS\Refinery\To\Group::tupleOf ( array  $transformation)

Returns an object that allows to transform the values of an array with the given array of transformations objects.

The length of the array of transformations MUST be identical to the array of values to transform. The keys of the transformation array will be the same as the key from the value array e.g. Transformation on position 2 will transform value on position 2 of the value array.

Using ILIAS\Refinery\Factory::to() will check if the value is identical to the value after the transformation.

Parameters
Transformation[]$transformation
Returns
Transformation

Definition at line 124 of file Group.php.

124  : Transformation
125  {
126  return new TupleTransformation($transformation);
127  }

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