ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
PHPExcel_Worksheet_RowIterator Class Reference
+ Inheritance diagram for PHPExcel_Worksheet_RowIterator:
+ Collaboration diagram for PHPExcel_Worksheet_RowIterator:

Public Member Functions

 __construct (PHPExcel_Worksheet $subject=null, $startRow=1, $endRow=null)
 Create a new row iterator. More...
 
 __destruct ()
 Destructor. More...
 
 resetStart ($startRow=1)
 (Re)Set the start row and the current row pointer More...
 
 resetEnd ($endRow=null)
 (Re)Set the end row More...
 
 seek ($row=1)
 Set the row pointer to the selected row. More...
 
 rewind ()
 Rewind the iterator to the starting row. More...
 
 current ()
 Return the current row in this worksheet. More...
 
 key ()
 Return the current iterator key. More...
 
 next ()
 Set the iterator to its next value. More...
 
 prev ()
 Set the iterator to its previous value. More...
 
 valid ()
 Indicate if more rows exist in the worksheet range of rows that we're iterating. More...
 

Private Attributes

 $_subject
 
 $_position = 1
 
 $_startRow = 1
 
 $_endRow = 1
 

Detailed Description

Definition at line 38 of file RowIterator.php.

Constructor & Destructor Documentation

◆ __construct()

PHPExcel_Worksheet_RowIterator::__construct ( PHPExcel_Worksheet  $subject = null,
  $startRow = 1,
  $endRow = null 
)

Create a new row iterator.

Parameters
PHPExcel_Worksheet$subjectThe worksheet to iterate over
integer$startRowThe row number at which to start iterating
integer$endRowOptionally, the row number at which to stop iterating

Definition at line 77 of file RowIterator.php.

References resetEnd(), and resetStart().

77  {
78  // Set subject
79  $this->_subject = $subject;
80  $this->resetEnd($endRow);
81  $this->resetStart($startRow);
82  }
resetEnd($endRow=null)
(Re)Set the end row
resetStart($startRow=1)
(Re)Set the start row and the current row pointer
Definition: RowIterator.php:97
+ Here is the call graph for this function:

◆ __destruct()

PHPExcel_Worksheet_RowIterator::__destruct ( )

Destructor.

Definition at line 87 of file RowIterator.php.

87  {
88  unset($this->_subject);
89  }

Member Function Documentation

◆ current()

PHPExcel_Worksheet_RowIterator::current ( )

Return the current row in this worksheet.

Returns
PHPExcel_Worksheet_Row

Definition at line 144 of file RowIterator.php.

144  {
145  return new PHPExcel_Worksheet_Row($this->_subject, $this->_position);
146  }

◆ key()

PHPExcel_Worksheet_RowIterator::key ( )

Return the current iterator key.

Returns
int

Definition at line 153 of file RowIterator.php.

References $_position.

153  {
154  return $this->_position;
155  }

◆ next()

PHPExcel_Worksheet_RowIterator::next ( )

Set the iterator to its next value.

Definition at line 160 of file RowIterator.php.

References $_position.

◆ prev()

PHPExcel_Worksheet_RowIterator::prev ( )

Set the iterator to its previous value.

Definition at line 167 of file RowIterator.php.

References $_position.

167  {
168  if ($this->_position <= $this->_startRow) {
169  throw new PHPExcel_Exception("Row is already at the beginning of range ({$this->_startRow} - {$this->_endRow})");
170  }
171 
173  }

◆ resetEnd()

PHPExcel_Worksheet_RowIterator::resetEnd (   $endRow = null)

(Re)Set the end row

Parameters
integer$endRowThe row number at which to stop iterating
Returns
PHPExcel_Worksheet_RowIterator

Definition at line 110 of file RowIterator.php.

Referenced by __construct().

110  {
111  $this->_endRow = ($endRow) ? $endRow : $this->_subject->getHighestRow();
112 
113  return $this;
114  }
+ Here is the caller graph for this function:

◆ resetStart()

PHPExcel_Worksheet_RowIterator::resetStart (   $startRow = 1)

(Re)Set the start row and the current row pointer

Parameters
integer$startRowThe row number at which to start iterating
Returns
PHPExcel_Worksheet_RowIterator

Definition at line 97 of file RowIterator.php.

References seek().

Referenced by __construct().

97  {
98  $this->_startRow = $startRow;
99  $this->seek($startRow);
100 
101  return $this;
102  }
seek($row=1)
Set the row pointer to the selected row.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ rewind()

PHPExcel_Worksheet_RowIterator::rewind ( )

Rewind the iterator to the starting row.

Definition at line 135 of file RowIterator.php.

References $_startRow.

135  {
136  $this->_position = $this->_startRow;
137  }

◆ seek()

PHPExcel_Worksheet_RowIterator::seek (   $row = 1)

Set the row pointer to the selected row.

Parameters
integer$rowThe row number to set the current pointer at
Returns
PHPExcel_Worksheet_RowIterator
Exceptions
PHPExcel_Exception

Definition at line 123 of file RowIterator.php.

References $row.

Referenced by resetStart().

123  {
124  if (($row < $this->_startRow) || ($row > $this->_endRow)) {
125  throw new PHPExcel_Exception("Row $row is out of range ({$this->_startRow} - {$this->_endRow})");
126  }
127  $this->_position = $row;
128 
129  return $this;
130  }
+ Here is the caller graph for this function:

◆ valid()

PHPExcel_Worksheet_RowIterator::valid ( )

Indicate if more rows exist in the worksheet range of rows that we're iterating.

Returns
boolean

Definition at line 180 of file RowIterator.php.

References $_endRow.

180  {
181  return $this->_position <= $this->_endRow;
182  }

Field Documentation

◆ $_endRow

PHPExcel_Worksheet_RowIterator::$_endRow = 1
private

Definition at line 67 of file RowIterator.php.

Referenced by valid().

◆ $_position

PHPExcel_Worksheet_RowIterator::$_position = 1
private

Definition at line 52 of file RowIterator.php.

Referenced by key(), next(), and prev().

◆ $_startRow

PHPExcel_Worksheet_RowIterator::$_startRow = 1
private

Definition at line 59 of file RowIterator.php.

Referenced by rewind().

◆ $_subject

PHPExcel_Worksheet_RowIterator::$_subject
private

Definition at line 45 of file RowIterator.php.


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