spout/src/Spout/Reader/CSV/Sheet.php
Adrien Loison 0978d340f0 Option to keep empty rows (#331)
* Add option to preserve empty rows when reading an XLSX file
* Add option to preserve empty rows when reading a CSV file
* Add option to preserve empty rows when reading an ODS file
2016-10-17 10:20:02 -07:00

47 lines
1.4 KiB
PHP

<?php
namespace Box\Spout\Reader\CSV;
use Box\Spout\Reader\SheetInterface;
/**
* Class Sheet
*
* @package Box\Spout\Reader\CSV
*/
class Sheet implements SheetInterface
{
/** @var \Box\Spout\Reader\CSV\RowIterator To iterate over the CSV's rows */
protected $rowIterator;
/**
* @param resource $filePointer Pointer to the CSV file to read
* @param string $fieldDelimiter Character that delimits fields
* @param string $fieldEnclosure Character that enclose fields
* @param string $endOfLineCharacter Character defining the end of a line
* @param string $encoding Encoding of the CSV file to be read
* @param bool $shouldPreserveEmptyRows Whether empty rows should be returned or skipped
* @param \Box\Spout\Common\Helper\GlobalFunctionsHelper $globalFunctionsHelper
*/
public function __construct(
$filePointer, $fieldDelimiter, $fieldEnclosure,
$endOfLineCharacter, $encoding, $shouldPreserveEmptyRows,
$globalFunctionsHelper)
{
$this->rowIterator = new RowIterator(
$filePointer, $fieldDelimiter, $fieldEnclosure,
$endOfLineCharacter, $encoding, $shouldPreserveEmptyRows,
$globalFunctionsHelper
);
}
/**
* @api
* @return \Box\Spout\Reader\CSV\RowIterator
*/
public function getRowIterator()
{
return $this->rowIterator;
}
}