[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/lib/phpexcel/PHPExcel/ -> WorksheetIterator.php (source)

   1  <?php
   2  
   3  /**
   4   * PHPExcel_WorksheetIterator
   5   *
   6   * Copyright (c) 2006 - 2015 PHPExcel
   7   *
   8   * This library is free software; you can redistribute it and/or
   9   * modify it under the terms of the GNU Lesser General Public
  10   * License as published by the Free Software Foundation; either
  11   * version 2.1 of the License, or (at your option) any later version.
  12   *
  13   * This library is distributed in the hope that it will be useful,
  14   * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  16   * Lesser General Public License for more details.
  17   *
  18   * You should have received a copy of the GNU Lesser General Public
  19   * License along with this library; if not, write to the Free Software
  20   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  21   *
  22   * @category   PHPExcel
  23   * @package    PHPExcel
  24   * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
  25   * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
  26   * @version    ##VERSION##, ##DATE##
  27   */
  28  class PHPExcel_WorksheetIterator implements Iterator
  29  {
  30      /**
  31       * Spreadsheet to iterate
  32       *
  33       * @var PHPExcel
  34       */
  35      private $subject;
  36  
  37      /**
  38       * Current iterator position
  39       *
  40       * @var int
  41       */
  42      private $position = 0;
  43  
  44      /**
  45       * Create a new worksheet iterator
  46       *
  47       * @param PHPExcel         $subject
  48       */
  49      public function __construct(PHPExcel $subject = null)
  50      {
  51          // Set subject
  52          $this->subject = $subject;
  53      }
  54  
  55      /**
  56       * Destructor
  57       */
  58      public function __destruct()
  59      {
  60          unset($this->subject);
  61      }
  62  
  63      /**
  64       * Rewind iterator
  65       */
  66      public function rewind()
  67      {
  68          $this->position = 0;
  69      }
  70  
  71      /**
  72       * Current PHPExcel_Worksheet
  73       *
  74       * @return PHPExcel_Worksheet
  75       */
  76      public function current()
  77      {
  78          return $this->subject->getSheet($this->position);
  79      }
  80  
  81      /**
  82       * Current key
  83       *
  84       * @return int
  85       */
  86      public function key()
  87      {
  88          return $this->position;
  89      }
  90  
  91      /**
  92       * Next value
  93       */
  94      public function next()
  95      {
  96          ++$this->position;
  97      }
  98  
  99      /**
 100       * More PHPExcel_Worksheet instances available?
 101       *
 102       * @return boolean
 103       */
 104      public function valid()
 105      {
 106          return $this->position < $this->subject->getSheetCount();
 107      }
 108  }


Generated: Thu Aug 11 10:00:09 2016 Cross-referenced by PHPXref 0.7.1