ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
CoreTestIterator Class Reference
+ Inheritance diagram for CoreTestIterator:
+ Collaboration diagram for CoreTestIterator:

Public Member Functions

 __construct (array $values, array $keys, $allowValueAccess=false, $maxPosition=false)
 
 rewind ()
 
 current ()
 
 key ()
 
 next ()
 
 valid ()
 

Private Attributes

 $position
 
 $array
 
 $arrayKeys
 
 $allowValueAccess
 
 $maxPosition
 

Detailed Description

Definition at line 307 of file CoreTest.php.

Constructor & Destructor Documentation

◆ __construct()

CoreTestIterator::__construct ( array  $values,
array  $keys,
  $allowValueAccess = false,
  $maxPosition = false 
)

Definition at line 315 of file CoreTest.php.

316 {
317 $this->array = $values;
318 $this->arrayKeys = $keys;
319 $this->position = 0;
320 $this->allowValueAccess = $allowValueAccess;
321 $this->maxPosition = false === $maxPosition ? count($values) + 1 : $maxPosition;
322 }
$keys

References $allowValueAccess, $keys, and $maxPosition.

Member Function Documentation

◆ current()

CoreTestIterator::current ( )

Definition at line 329 of file CoreTest.php.

330 {
331 if ($this->allowValueAccess) {
332 return $this->array[$this->key()];
333 }
334
335 throw new LogicException('Code should only use the keys, not the values provided by iterator.');
336 }

References key().

+ Here is the call graph for this function:

◆ key()

CoreTestIterator::key ( )

Definition at line 338 of file CoreTest.php.

339 {
340 return $this->arrayKeys[$this->position];
341 }

References $position.

Referenced by current().

+ Here is the caller graph for this function:

◆ next()

CoreTestIterator::next ( )

Definition at line 343 of file CoreTest.php.

344 {
346 if ($this->position === $this->maxPosition) {
347 throw new LogicException(sprintf('Code should not iterate beyond %d.', $this->maxPosition));
348 }
349 }
sprintf('%.4f', $callTime)

References $position, and sprintf.

◆ rewind()

CoreTestIterator::rewind ( )

Definition at line 324 of file CoreTest.php.

325 {
326 $this->position = 0;
327 }

◆ valid()

CoreTestIterator::valid ( )

Definition at line 351 of file CoreTest.php.

352 {
353 return isset($this->arrayKeys[$this->position]);
354 }

Field Documentation

◆ $allowValueAccess

CoreTestIterator::$allowValueAccess
private

Definition at line 312 of file CoreTest.php.

Referenced by __construct().

◆ $array

CoreTestIterator::$array
private

Definition at line 310 of file CoreTest.php.

◆ $arrayKeys

CoreTestIterator::$arrayKeys
private

Definition at line 311 of file CoreTest.php.

◆ $maxPosition

CoreTestIterator::$maxPosition
private

Definition at line 313 of file CoreTest.php.

Referenced by __construct().

◆ $position

CoreTestIterator::$position
private

Definition at line 309 of file CoreTest.php.

Referenced by key(), and next().


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