ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
Assetic\Extension\Twig\ValueContainer Class Reference

Container for values initialized lazily from a ValueSupplierInterface. More...

+ Inheritance diagram for Assetic\Extension\Twig\ValueContainer:
+ Collaboration diagram for Assetic\Extension\Twig\ValueContainer:

Public Member Functions

 __construct (ValueSupplierInterface $valueSupplier)
 
 offsetExists ($offset)
 
 offsetGet ($offset)
 
 offsetSet ($offset, $value)
 
 offsetUnset ($offset)
 
 getIterator ()
 
 count ()
 

Private Member Functions

 initialize ()
 

Private Attributes

 $values
 
 $valueSupplier
 

Detailed Description

Container for values initialized lazily from a ValueSupplierInterface.

Author
Christophe Coevoet stof@.nosp@m.notk.nosp@m..org

Definition at line 21 of file ValueContainer.php.

Constructor & Destructor Documentation

◆ __construct()

Assetic\Extension\Twig\ValueContainer::__construct ( ValueSupplierInterface  $valueSupplier)

Definition at line 26 of file ValueContainer.php.

27 {
28 $this->valueSupplier = $valueSupplier;
29 }

References Assetic\Extension\Twig\ValueContainer\$valueSupplier.

Member Function Documentation

◆ count()

Assetic\Extension\Twig\ValueContainer::count ( )

Definition at line 66 of file ValueContainer.php.

67 {
68 $this->initialize();
69
70 return count($this->values);
71 }

References Assetic\Extension\Twig\ValueContainer\count(), and Assetic\Extension\Twig\ValueContainer\initialize().

Referenced by Assetic\Extension\Twig\ValueContainer\count().

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

◆ getIterator()

Assetic\Extension\Twig\ValueContainer::getIterator ( )

Definition at line 59 of file ValueContainer.php.

60 {
61 $this->initialize();
62
63 return new \ArrayIterator($this->values);
64 }

References Assetic\Extension\Twig\ValueContainer\initialize().

+ Here is the call graph for this function:

◆ initialize()

Assetic\Extension\Twig\ValueContainer::initialize ( )
private

Definition at line 73 of file ValueContainer.php.

74 {
75 if (null === $this->values) {
76 $this->values = $this->valueSupplier->getValues();
77 }
78 }

Referenced by Assetic\Extension\Twig\ValueContainer\count(), Assetic\Extension\Twig\ValueContainer\getIterator(), Assetic\Extension\Twig\ValueContainer\offsetExists(), and Assetic\Extension\Twig\ValueContainer\offsetGet().

+ Here is the caller graph for this function:

◆ offsetExists()

Assetic\Extension\Twig\ValueContainer::offsetExists (   $offset)

Definition at line 31 of file ValueContainer.php.

32 {
33 $this->initialize();
34
35 return array_key_exists($offset, $this->values);
36 }

References Assetic\Extension\Twig\ValueContainer\initialize().

+ Here is the call graph for this function:

◆ offsetGet()

Assetic\Extension\Twig\ValueContainer::offsetGet (   $offset)

Definition at line 38 of file ValueContainer.php.

39 {
40 $this->initialize();
41
42 if (!array_key_exists($offset, $this->values)) {
43 throw new \OutOfRangeException(sprintf('The variable "%s" does not exist.', $offset));
44 }
45
46 return $this->values[$offset];
47 }
sprintf('%.4f', $callTime)

References Assetic\Extension\Twig\ValueContainer\initialize(), and sprintf.

+ Here is the call graph for this function:

◆ offsetSet()

Assetic\Extension\Twig\ValueContainer::offsetSet (   $offset,
  $value 
)

Definition at line 49 of file ValueContainer.php.

50 {
51 throw new \BadMethodCallException('The ValueContainer is read-only.');
52 }

◆ offsetUnset()

Assetic\Extension\Twig\ValueContainer::offsetUnset (   $offset)

Definition at line 54 of file ValueContainer.php.

55 {
56 throw new \BadMethodCallException('The ValueContainer is read-only.');
57 }

Field Documentation

◆ $values

Assetic\Extension\Twig\ValueContainer::$values
private

Definition at line 23 of file ValueContainer.php.

◆ $valueSupplier

Assetic\Extension\Twig\ValueContainer::$valueSupplier
private

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