ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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 31 of file MapValues.php.

Constructor & Destructor Documentation

◆ __construct()

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

Definition at line 39 of file MapValues.php.

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

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

Member Function Documentation

◆ transform()

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

@inheritDoc

Implements ILIAS\Refinery\Transformation.

Definition at line 47 of file MapValues.php.

47 : array
48 {
49 if (!is_array($from)) {
50 throw new InvalidArgumentException(__METHOD__ . " argument is not an array.");
51 }
52
53 return array_map(function ($a) {
54 return $this->trafo->transform($a);
55 }, $from);
56 }
$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 37 of file MapValues.php.

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

◆ $type

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

Definition at line 36 of file MapValues.php.


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