* 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
47 lines
1.4 KiB
PHP
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;
|
|
}
|
|
}
|