ILIAS  trunk Revision v11.0_alpha-2645-g16283d3b3f8
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.

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

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

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  }

◆ getApplicator()

ILIAS\Refinery\KeyValueAccess::getApplicator ( )
private

Definition at line 54 of file KeyValueAccess.php.

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

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  }
+ Here is the caller graph for this function:

◆ offsetExists()

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

Definition at line 38 of file KeyValueAccess.php.

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

38  : bool
39  {
40  return isset($this->raw_values[$offset]);
41  }
+ Here is the caller graph for this function:

◆ offsetGet()

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

Definition at line 43 of file KeyValueAccess.php.

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

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  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:

◆ offsetSet()

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

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)

Definition at line 72 of file KeyValueAccess.php.

References ILIAS\Refinery\KeyValueAccess\offsetExists().

72  : void
73  {
74  if ($this->offsetExists($offset)) {
75  unset($this->raw_values[$offset]);
76  }
77  }
+ Here is the call graph for this function:

Field Documentation

◆ $raw_values

array ILIAS\Refinery\KeyValueAccess::$raw_values
private

Definition at line 29 of file KeyValueAccess.php.

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

◆ $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: