ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\Refinery\KeyValueAccess Class Reference
+ Inheritance diagram for ILIAS\Refinery\KeyValueAccess:
+ Collaboration diagram for ILIAS\Refinery\KeyValueAccess:

Public Member Functions

 __construct (array $raw_values, Transformation $trafo)
 
 offsetExists (mixed $offset)
 
 offsetGet (mixed $offset)
 
 offsetSet (mixed $offset, mixed $value)
 
 offsetUnset (mixed $offset)
 
 count ()
 

Private Member Functions

 getApplicator ()
 

Private Attributes

array $raw_values
 
Transformation $trafo
 

Detailed Description

Definition at line 27 of file KeyValueAccess.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Refinery\KeyValueAccess::__construct ( array  $raw_values,
Transformation  $trafo 
)

Definition at line 32 of file KeyValueAccess.php.

33 {
34 $this->trafo = $trafo;
35 $this->raw_values = $raw_values;
36 }

References ILIAS\Refinery\KeyValueAccess\$raw_values, and ILIAS\Refinery\KeyValueAccess\$trafo.

Member Function Documentation

◆ count()

ILIAS\Refinery\KeyValueAccess::count ( )

Definition at line 79 of file KeyValueAccess.php.

79 : int
80 {
81 return count($this->raw_values);
82 }

References ILIAS\Refinery\KeyValueAccess\count().

Referenced by ILIAS\Refinery\KeyValueAccess\count().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getApplicator()

ILIAS\Refinery\KeyValueAccess::getApplicator ( )
private

Definition at line 54 of file KeyValueAccess.php.

54 : Closure
55 {
56 return function ($value) {
57 if (is_array($value)) {
58 foreach ($value as $k => $v) {
59 $value[$k] = $this->getApplicator()($v);
60 }
61 return $value;
62 }
63 return $this->trafo->transform($value);
64 };
65 }

References ILIAS\Refinery\KeyValueAccess\getApplicator().

Referenced by ILIAS\Refinery\KeyValueAccess\getApplicator(), and ILIAS\Refinery\KeyValueAccess\offsetGet().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ offsetExists()

ILIAS\Refinery\KeyValueAccess::offsetExists ( mixed  $offset)

Definition at line 38 of file KeyValueAccess.php.

38 : bool
39 {
40 return isset($this->raw_values[$offset]);
41 }

Referenced by ILIAS\Refinery\KeyValueAccess\offsetGet(), and ILIAS\Refinery\KeyValueAccess\offsetUnset().

+ Here is the caller graph for this function:

◆ offsetGet()

ILIAS\Refinery\KeyValueAccess::offsetGet ( mixed  $offset)

Definition at line 43 of file KeyValueAccess.php.

43 : mixed
44 {
45 if (!$this->offsetExists($offset)) {
46 return null;
47 }
48
49 return is_array($this->raw_values[$offset])
50 ? array_map($this->getApplicator(), $this->raw_values[$offset])
51 : $this->getApplicator()($this->raw_values[$offset]);
52 }

References ILIAS\Refinery\KeyValueAccess\getApplicator(), and ILIAS\Refinery\KeyValueAccess\offsetExists().

+ Here is the call graph for this function:

◆ offsetSet()

ILIAS\Refinery\KeyValueAccess::offsetSet ( mixed  $offset,
mixed  $value 
)

Reimplemented in ILIAS\HTTP\Wrapper\SuperGlobalDropInReplacement.

Definition at line 67 of file KeyValueAccess.php.

67 : void
68 {
69 $this->raw_values[$offset] = $value;
70 }

◆ offsetUnset()

ILIAS\Refinery\KeyValueAccess::offsetUnset ( mixed  $offset)

Reimplemented in ILIAS\HTTP\Wrapper\SuperGlobalDropInReplacement.

Definition at line 72 of file KeyValueAccess.php.

72 : void
73 {
74 if ($this->offsetExists($offset)) {
75 unset($this->raw_values[$offset]);
76 }
77 }

References ILIAS\Refinery\KeyValueAccess\offsetExists().

+ Here is the call graph for this function:

Field Documentation

◆ $raw_values

array ILIAS\Refinery\KeyValueAccess::$raw_values
private

◆ $trafo

Transformation ILIAS\Refinery\KeyValueAccess::$trafo
private

Definition at line 30 of file KeyValueAccess.php.

Referenced by ILIAS\Refinery\KeyValueAccess\__construct().


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