| 1 |
<?php |
| 2 |
|
| 3 |
namespace Box\Spout\Reader\CSV; |
| 4 |
|
| 5 |
use Box\Spout\Reader\SheetInterface; |
| 6 |
|
| 7 |
/** |
| 8 |
* Class Sheet |
| 9 |
* |
| 10 |
* @package Box\Spout\Reader\CSV |
| 11 |
*/ |
| 12 |
class Sheet implements SheetInterface |
| 13 |
{ |
| 14 |
/** @var \Box\Spout\Reader\CSV\RowIterator To iterate over the CSV's rows */ |
| 15 |
protected $rowIterator; |
| 16 |
|
| 17 |
/** |
| 18 |
* @param resource $filePointer Pointer to the CSV file to read |
| 19 |
* @param \Box\Spout\Reader\CSV\ReaderOptions $options |
| 20 |
* @param \Box\Spout\Common\Helper\GlobalFunctionsHelper $globalFunctionsHelper |
| 21 |
*/ |
| 22 |
public function __construct($filePointer, $options, $globalFunctionsHelper) |
| 23 |
{ |
| 24 |
$this->rowIterator = new RowIterator($filePointer, $options, $globalFunctionsHelper); |
| 25 |
} |
| 26 |
|
| 27 |
/** |
| 28 |
* @api |
| 29 |
* @return \Box\Spout\Reader\CSV\RowIterator |
| 30 |
*/ |
| 31 |
public function getRowIterator() |
| 32 |
{ |
| 33 |
return $this->rowIterator; |
| 34 |
} |
| 35 |
|
| 36 |
/** |
| 37 |
* @api |
| 38 |
* @return int Index of the sheet |
| 39 |
*/ |
| 40 |
public function getIndex() |
| 41 |
{ |
| 42 |
return 0; |
| 43 |
} |
| 44 |
|
| 45 |
/** |
| 46 |
* @api |
| 47 |
* @return string Name of the sheet - empty string since CSV does not support that |
| 48 |
*/ |
| 49 |
public function getName() |
| 50 |
{ |
| 51 |
return ''; |
| 52 |
} |
| 53 |
|
| 54 |
/** |
| 55 |
* @api |
| 56 |
* @return bool Always TRUE as there is only one sheet |
| 57 |
*/ |
| 58 |
public function isActive() |
| 59 |
{ |
| 60 |
return true; |
| 61 |
} |
| 62 |
} |
| 63 |
|