PHP Класс Box\Spout\Reader\CSV\RowIterator

Наследование: implements Box\Spout\Reader\IteratorInterface
Показать файл Открыть проект

Защищенные свойства (Protected)

Свойство Тип Описание
$encodedEOLDelimiter End of line delimiter, encoded using the same encoding as the CSV
$encoding Encoding of the CSV file to be read
$encodingHelper Helper to work with different encodings
$fieldDelimiter Defines the character used to delimit fields (one character only)
$fieldEnclosure Defines the character used to enclose fields (one character only)
$filePointer Pointer to the CSV file to read
$globalFunctionsHelper Helper to work with global functions
$hasReachedEndOfFile Indicates whether all rows have been read
$inputEOLDelimiter End of line delimiter, given by the user as input.
$numReadRows Number of read rows
$rowDataBuffer Buffer used to store the row data, while checking if there are more rows to read
$shouldPreserveEmptyRows Whether empty rows should be returned or skipped

Открытые методы

Метод Описание
__construct ( resource $filePointer, ReaderOptions $options, Box\Spout\Common\Helper\GlobalFunctionsHelper $globalFunctionsHelper )
current ( ) : array | null Return the current element from the buffer
end ( ) : void Cleans up what was created to iterate over the object.
key ( ) : integer Return the key of the current element
next ( ) : void Move forward to next element. Reads data for the next unprocessed row.
rewind ( ) : void Rewind the Iterator to the first element
valid ( ) : boolean Checks if current position is valid

Защищенные методы

Метод Описание
getEncodedEOLDelimiter ( ) : string Returns the end of line delimiter, encoded using the same encoding as the CSV.
getNextUTF8EncodedRow ( ) : array | false Returns the next row, converted if necessary to UTF-8.
isEmptyLine ( array | boolean $lineData ) : boolean
readDataForNextRow ( ) : void
rewindAndSkipBom ( ) : void This rewinds and skips the BOM if inserted at the beginning of the file by moving the file pointer after it, so that it is not read.
shouldReadNextRow ( array | boolean $currentRowData ) : boolean

Описание методов

__construct() публичный Метод

public __construct ( resource $filePointer, ReaderOptions $options, Box\Spout\Common\Helper\GlobalFunctionsHelper $globalFunctionsHelper )
$filePointer resource Pointer to the CSV file to read
$options ReaderOptions
$globalFunctionsHelper Box\Spout\Common\Helper\GlobalFunctionsHelper

current() публичный Метод

Return the current element from the buffer
public current ( ) : array | null
Результат array | null

end() публичный Метод

Cleans up what was created to iterate over the object.
public end ( ) : void
Результат void

getEncodedEOLDelimiter() защищенный Метод

The return value is cached.
protected getEncodedEOLDelimiter ( ) : string
Результат string

getNextUTF8EncodedRow() защищенный Метод

As fgetcsv() does not manage correctly encoding for non UTF-8 data, we remove manually whitespace with ltrim or rtrim (depending on the order of the bytes)
protected getNextUTF8EncodedRow ( ) : array | false
Результат array | false The row for the current file pointer, encoded in UTF-8 or FALSE if nothing to read

isEmptyLine() защищенный Метод

protected isEmptyLine ( array | boolean $lineData ) : boolean
$lineData array | boolean Array containing the cells value for the line
Результат boolean Whether the given line is empty

key() публичный Метод

Return the key of the current element
public key ( ) : integer
Результат integer

next() публичный Метод

Move forward to next element. Reads data for the next unprocessed row.
public next ( ) : void
Результат void

readDataForNextRow() защищенный Метод

protected readDataForNextRow ( ) : void
Результат void

rewind() публичный Метод

Rewind the Iterator to the first element
public rewind ( ) : void
Результат void

rewindAndSkipBom() защищенный Метод

This rewinds and skips the BOM if inserted at the beginning of the file by moving the file pointer after it, so that it is not read.
protected rewindAndSkipBom ( ) : void
Результат void

shouldReadNextRow() защищенный Метод

protected shouldReadNextRow ( array | boolean $currentRowData ) : boolean
$currentRowData array | boolean
Результат boolean Whether the data for the current row can be returned or if we need to keep reading

valid() публичный Метод

Checks if current position is valid
public valid ( ) : boolean
Результат boolean

Описание свойств

$encodedEOLDelimiter защищенное свойство

End of line delimiter, encoded using the same encoding as the CSV
protected $encodedEOLDelimiter

$encoding защищенное свойство

Encoding of the CSV file to be read
protected $encoding

$encodingHelper защищенное свойство

Helper to work with different encodings
protected $encodingHelper

$fieldDelimiter защищенное свойство

Defines the character used to delimit fields (one character only)
protected $fieldDelimiter

$fieldEnclosure защищенное свойство

Defines the character used to enclose fields (one character only)
protected $fieldEnclosure

$filePointer защищенное свойство

Pointer to the CSV file to read
protected $filePointer

$globalFunctionsHelper защищенное свойство

Helper to work with global functions
protected $globalFunctionsHelper

$hasReachedEndOfFile защищенное свойство

Indicates whether all rows have been read
protected $hasReachedEndOfFile

$inputEOLDelimiter защищенное свойство

End of line delimiter, given by the user as input.
protected $inputEOLDelimiter

$numReadRows защищенное свойство

Number of read rows
protected $numReadRows

$rowDataBuffer защищенное свойство

Buffer used to store the row data, while checking if there are more rows to read
protected $rowDataBuffer

$shouldPreserveEmptyRows защищенное свойство

Whether empty rows should be returned or skipped
protected $shouldPreserveEmptyRows