ILIAS  release_8 Revision v8.23
ILIAS\Refinery\Container\MapValues Class Reference

Adds to any array keys for each value. More...

+ Inheritance diagram for ILIAS\Refinery\Container\MapValues:
+ Collaboration diagram for ILIAS\Refinery\Container\MapValues:

Public Member Functions

 __construct (Transformation $trafo)
 
 transform ($from)
 
- Public Member Functions inherited from ILIAS\Refinery\Transformation
 applyTo (Result $result)
 Perform the transformation and reify possible failures. More...
 
 __invoke ($from)
 Transformations should be callable. More...
 

Protected Attributes

string $type
 

Private Attributes

Transformation $trafo
 

Detailed Description

Adds to any array keys for each value.

Definition at line 32 of file MapValues.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Refinery\Container\MapValues::__construct ( Transformation  $trafo)

Definition at line 40 of file MapValues.php.

References ILIAS\Refinery\Container\MapValues\$trafo.

41  {
42  $this->trafo = $trafo;
43  }

Member Function Documentation

◆ transform()

ILIAS\Refinery\Container\MapValues::transform (   $from)

Implements ILIAS\Refinery\Transformation.

Definition at line 48 of file MapValues.php.

References Vendor\Package\$a.

48  : array
49  {
50  if (!is_array($from)) {
51  throw new InvalidArgumentException(__METHOD__ . " argument is not an array.");
52  }
53 
54  return array_map(function ($a) {
55  return $this->trafo->transform($a);
56  }, $from);
57  }
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples

Field Documentation

◆ $trafo

Transformation ILIAS\Refinery\Container\MapValues::$trafo
private

Definition at line 38 of file MapValues.php.

Referenced by ILIAS\Refinery\Container\MapValues\__construct().

◆ $type

string ILIAS\Refinery\Container\MapValues::$type
protected

Definition at line 37 of file MapValues.php.


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