MediaWiki REL1_37
ExplodeIterator Class Reference

An iterator which works exactly like: More...

Inheritance diagram for ExplodeIterator:
Collaboration diagram for ExplodeIterator:

Public Member Functions

 __construct ( $delim, $subject)
 Construct a DelimIterator.
 
 current ()
 
 key ()
 
 next ()
 
 refreshCurrent ()
 
 rewind ()
 
 valid ()
 

Private Attributes

int $curPos
 The position of the start of the line.
 
string false $current
 The current token.
 
string $delim
 
int $delimLength
 
int $endPos
 The position after the end of the next delimiter.
 
string $subject
 
int $subjectLength
 

Detailed Description

An iterator which works exactly like:

foreach ( explode( $delim, $s ) as $element ) { ... }

Except it doesn't use 193 byte per element

Definition at line 30 of file ExplodeIterator.php.

Constructor & Destructor Documentation

◆ __construct()

ExplodeIterator::__construct (   $delim,
  $subject 
)

Construct a DelimIterator.

Parameters
string$delim
string$subject

Definition at line 57 of file ExplodeIterator.php.

References $delim, $subject, and rewind().

Member Function Documentation

◆ current()

ExplodeIterator::current ( )
Returns
string|false

Definition at line 90 of file ExplodeIterator.php.

◆ key()

ExplodeIterator::key ( )
Returns
int|bool Current position or boolean false if invalid

Definition at line 98 of file ExplodeIterator.php.

◆ next()

ExplodeIterator::next ( )
Returns
void

Definition at line 105 of file ExplodeIterator.php.

◆ refreshCurrent()

ExplodeIterator::refreshCurrent ( )

Definition at line 74 of file ExplodeIterator.php.

◆ rewind()

ExplodeIterator::rewind ( )

Definition at line 68 of file ExplodeIterator.php.

Referenced by __construct().

◆ valid()

ExplodeIterator::valid ( )
Returns
bool

Definition at line 122 of file ExplodeIterator.php.

Member Data Documentation

◆ $curPos

int ExplodeIterator::$curPos
private

The position of the start of the line.

Definition at line 44 of file ExplodeIterator.php.

◆ $current

string false ExplodeIterator::$current
private

The current token.

Definition at line 50 of file ExplodeIterator.php.

◆ $delim

string ExplodeIterator::$delim
private

Definition at line 38 of file ExplodeIterator.php.

Referenced by __construct().

◆ $delimLength

int ExplodeIterator::$delimLength
private

Definition at line 41 of file ExplodeIterator.php.

◆ $endPos

int ExplodeIterator::$endPos
private

The position after the end of the next delimiter.

Definition at line 47 of file ExplodeIterator.php.

◆ $subject

string ExplodeIterator::$subject
private

Definition at line 32 of file ExplodeIterator.php.

Referenced by __construct().

◆ $subjectLength

int ExplodeIterator::$subjectLength
private

Definition at line 35 of file ExplodeIterator.php.


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