ILIAS  release_8 Revision v8.24
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)
 @inheritDoc More...
 
- Public Member Functions inherited from ILIAS\Refinery\Transformation
 transform ($from)
 Perform the transformation. More...
 
 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.

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

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

Member Function Documentation

◆ transform()

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

@inheritDoc

Implements ILIAS\Refinery\Transformation.

Definition at line 48 of file MapValues.php.

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

References Vendor\Package\$a.

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: