ILIAS  release_8 Revision v8.24
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 ($offset)
 @inheritDoc More...
 
 offsetGet ($offset)
 @inheritDoc More...
 
 offsetSet ($offset, $value)
 @inheritDoc More...
 
 offsetUnset ($offset)
 @inheritDoc More...
 
 count ()
 @inheritDoc More...
 

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 ( )

@inheritDoc

Definition at line 94 of file KeyValueAccess.php.

94 : int
95 {
96 return count($this->raw_values);
97 }

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 60 of file KeyValueAccess.php.

60 : Closure
61 {
62 return function ($value) {
63 if (is_array($value)) {
64 foreach ($value as $k => $v) {
65 $value[$k] = $this->getApplicator()($v);
66 }
67 return $value;
68 }
69 return $this->trafo->transform($value);
70 };
71 }

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 (   $offset)

@inheritDoc

Definition at line 41 of file KeyValueAccess.php.

41 : bool
42 {
43 return isset($this->raw_values[$offset]);
44 }

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

+ Here is the caller graph for this function:

◆ offsetGet()

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

@inheritDoc

Definition at line 49 of file KeyValueAccess.php.

50 {
51 if (!$this->offsetExists($offset)) {
52 return null;
53 }
54
55 return is_array($this->raw_values[$offset])
56 ? array_map($this->getApplicator(), $this->raw_values[$offset])
57 : $this->getApplicator()($this->raw_values[$offset]);
58 }
offsetExists($offset)
@inheritDoc

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

+ Here is the call graph for this function:

◆ offsetSet()

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

@inheritDoc

Reimplemented in ILIAS\HTTP\Wrapper\SuperGlobalDropInReplacement.

Definition at line 76 of file KeyValueAccess.php.

76 : void
77 {
78 $this->raw_values[$offset] = $value;
79 }

◆ offsetUnset()

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

@inheritDoc

Reimplemented in ILIAS\HTTP\Wrapper\SuperGlobalDropInReplacement.

Definition at line 84 of file KeyValueAccess.php.

84 : void
85 {
86 if ($this->offsetExists($offset)) {
87 unset($this->raw_values[$offset]);
88 }
89 }

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: