You are here

class PHPExcel_WorksheetIterator in Loft Data Grids 7.2

Same name and namespace in other branches
  1. 6.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/WorksheetIterator.php \PHPExcel_WorksheetIterator

PHPExcel_WorksheetIterator

Used to iterate worksheets in PHPExcel

@category PHPExcel @package PHPExcel @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)

Hierarchy

Expanded class hierarchy of PHPExcel_WorksheetIterator

File

vendor/phpoffice/phpexcel/Classes/PHPExcel/WorksheetIterator.php, line 38

View source
class PHPExcel_WorksheetIterator implements Iterator {

  /**
   * Spreadsheet to iterate
   *
   * @var PHPExcel
   */
  private $_subject;

  /**
   * Current iterator position
   *
   * @var int
   */
  private $_position = 0;

  /**
   * Create a new worksheet iterator
   *
   * @param PHPExcel         $subject
   */
  public function __construct(PHPExcel $subject = null) {

    // Set subject
    $this->_subject = $subject;
  }

  /**
   * Destructor
   */
  public function __destruct() {
    unset($this->_subject);
  }

  /**
   * Rewind iterator
   */
  public function rewind() {
    $this->_position = 0;
  }

  /**
   * Current PHPExcel_Worksheet
   *
   * @return PHPExcel_Worksheet
   */
  public function current() {
    return $this->_subject
      ->getSheet($this->_position);
  }

  /**
   * Current key
   *
   * @return int
   */
  public function key() {
    return $this->_position;
  }

  /**
   * Next value
   */
  public function next() {
    ++$this->_position;
  }

  /**
   * More PHPExcel_Worksheet instances available?
   *
   * @return boolean
   */
  public function valid() {
    return $this->_position < $this->_subject
      ->getSheetCount();
  }

}

Members

Namesort descending Modifiers Type Description Overrides
PHPExcel_WorksheetIterator::$_position private property Current iterator position
PHPExcel_WorksheetIterator::$_subject private property Spreadsheet to iterate
PHPExcel_WorksheetIterator::current public function Current PHPExcel_Worksheet
PHPExcel_WorksheetIterator::key public function Current key
PHPExcel_WorksheetIterator::next public function Next value
PHPExcel_WorksheetIterator::rewind public function Rewind iterator
PHPExcel_WorksheetIterator::valid public function More PHPExcel_Worksheet instances available?
PHPExcel_WorksheetIterator::__construct public function Create a new worksheet iterator
PHPExcel_WorksheetIterator::__destruct public function Destructor