ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilCtrlArrayIterator Class Reference

Class ilCtrlArrayIterator. More...

+ Inheritance diagram for ilCtrlArrayIterator:
+ Collaboration diagram for ilCtrlArrayIterator:

Public Member Functions

 __construct (array $data)
 ilCtrlArrayIterator Constructor More...
 
 current ()
 @inheritDoc More...
 
 next ()
 @inheritDoc More...
 
 key ()
 @inheritDoc More...
 
 valid ()
 @inheritDoc More...
 
 rewind ()
 @inheritDoc More...
 
 current ()
 @inheritDoc More...
 
 key ()
 @inheritDoc More...
 

Private Attributes

array $data
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilCtrlArrayIterator::__construct ( array  $data)

ilCtrlArrayIterator Constructor

Parameters
string[]

Definition at line 38 of file class.ilCtrlArrayIterator.php.

39 {
40 $this->data = $data;
41 }

References $data.

Member Function Documentation

◆ current()

ilCtrlArrayIterator::current ( )

@inheritDoc

Implements ilCtrlIteratorInterface.

Definition at line 46 of file class.ilCtrlArrayIterator.php.

46 : ?string
47 {
48 if ($this->valid()) {
49 return current($this->data);
50 }
51
52 return null;
53 }

References current(), and valid().

Referenced by current(), and valid().

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

◆ key()

ilCtrlArrayIterator::key ( )

@inheritDoc

Implements ilCtrlIteratorInterface.

Definition at line 66 of file class.ilCtrlArrayIterator.php.

66 : ?string
67 {
68 if ($this->valid()) {
69 return key($this->data);
70 }
71
72 return null;
73 }

References key(), and valid().

Referenced by key(), and valid().

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

◆ next()

ilCtrlArrayIterator::next ( )

@inheritDoc

Definition at line 58 of file class.ilCtrlArrayIterator.php.

58 : void
59 {
60 next($this->data);
61 }

References next().

Referenced by next(), and valid().

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

◆ rewind()

ilCtrlArrayIterator::rewind ( )

@inheritDoc

Definition at line 98 of file class.ilCtrlArrayIterator.php.

98 : void
99 {
100 reset($this->data);
101 }

◆ valid()

ilCtrlArrayIterator::valid ( )

@inheritDoc

Definition at line 78 of file class.ilCtrlArrayIterator.php.

78 : bool
79 {
80 $value = current($this->data);
81 $key = key($this->data);
82
83 if (null === $key) {
84 return false;
85 }
86
87 if (!is_string($value) || !is_string($key)) {
88 $this->next();
89 return $this->valid();
90 }
91
92 return true;
93 }

References current(), key(), next(), and valid().

Referenced by current(), key(), and valid().

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

Field Documentation

◆ $data

array ilCtrlArrayIterator::$data
private

Definition at line 31 of file class.ilCtrlArrayIterator.php.

Referenced by __construct().


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