PHP Class Box\Spout\Reader\AbstractReader

Inheritance: implements Box\Spout\Reader\ReaderInterface
Show file Open project: box/spout

Protected Properties

Property Type Description
$globalFunctionsHelper Helper to work with global functions
$isStreamOpened Indicates whether the stream is currently open
$options Reader's customized options

Public Methods

Method Description
close ( ) : void Closes the reader, preventing any additional reading
getSheetIterator ( ) : Iterator Returns an iterator to iterate over sheets.
open ( string $filePath ) : void Prepares the reader to read the given file. It also makes sure that the file exists and is readable.
setGlobalFunctionsHelper ( Box\Spout\Common\Helper\GlobalFunctionsHelper $globalFunctionsHelper ) : AbstractReader
setShouldFormatDates ( boolean $shouldFormatDates ) : AbstractReader Sets whether date/time values should be returned as PHP objects or be formatted as strings.
setShouldPreserveEmptyRows ( boolean $shouldPreserveEmptyRows ) : AbstractReader Sets whether empty rows should be returned or skipped.

Protected Methods

Method Description
closeReader ( ) : AbstractReader Closes the reader. To be used after reading the file.
doesSupportStreamWrapper ( ) : boolean Returns whether stream wrappers are supported
getConcreteSheetIterator ( ) : Iterator Returns an iterator to iterate over sheets.
getFileRealPath ( string $filePath ) : string Returns the real path of the given path.
getOptions ( ) : ReaderOptions Returns the reader's current options
getStreamWrapperScheme ( string $filePath ) : string | null Returns the scheme of the custom stream wrapper, if the path indicates a stream wrapper is used.
isPhpStream ( string $filePath ) : boolean Checks if a path is a PHP stream (like php://output, php://memory, .
isStreamWrapper ( string $filePath ) : boolean Checks if the given path is an unsupported stream wrapper (like local path, php://temp, mystream://foo/bar.
isSupportedStreamWrapper ( string $filePath ) : boolean Checks if the given path is an supported stream wrapper (like php://temp, mystream://foo/bar.
openReader ( string $filePath ) : void Opens the file at the given file path to make it ready to be read

Method Details

close() public method

Closes the reader, preventing any additional reading
public close ( ) : void
return void

closeReader() abstract protected method

Closes the reader. To be used after reading the file.
abstract protected closeReader ( ) : AbstractReader
return AbstractReader

doesSupportStreamWrapper() abstract protected method

Returns whether stream wrappers are supported
abstract protected doesSupportStreamWrapper ( ) : boolean
return boolean

getConcreteSheetIterator() abstract protected method

Returns an iterator to iterate over sheets.
abstract protected getConcreteSheetIterator ( ) : Iterator
return Iterator To iterate over sheets

getFileRealPath() protected method

If the given path is a valid stream wrapper, returns the path unchanged.
protected getFileRealPath ( string $filePath ) : string
$filePath string
return string

getOptions() abstract protected method

Returns the reader's current options
abstract protected getOptions ( ) : ReaderOptions
return Box\Spout\Reader\Common\ReaderOptions

getSheetIterator() public method

Returns an iterator to iterate over sheets.
public getSheetIterator ( ) : Iterator
return Iterator To iterate over sheets

getStreamWrapperScheme() protected method

For example, php://temp => php, s3://path/to/file => s3...
protected getStreamWrapperScheme ( string $filePath ) : string | null
$filePath string Path of the file to be read
return string | null The stream wrapper scheme or NULL if not a stream wrapper

isPhpStream() protected method

..)
protected isPhpStream ( string $filePath ) : boolean
$filePath string Path of the file to be read
return boolean Whether the given path maps to a PHP stream

isStreamWrapper() protected method

..).
protected isStreamWrapper ( string $filePath ) : boolean
$filePath string Path of the file to be read
return boolean Whether the given path is an unsupported stream wrapper

isSupportedStreamWrapper() protected method

..). If the given path is a local path, returns true.
protected isSupportedStreamWrapper ( string $filePath ) : boolean
$filePath string Path of the file to be read
return boolean Whether the given path is an supported stream wrapper

open() public method

Prepares the reader to read the given file. It also makes sure that the file exists and is readable.
public open ( string $filePath ) : void
$filePath string Path of the file to be read
return void

openReader() abstract protected method

Opens the file at the given file path to make it ready to be read
abstract protected openReader ( string $filePath ) : void
$filePath string Path of the file to be read
return void

setGlobalFunctionsHelper() public method

public setGlobalFunctionsHelper ( Box\Spout\Common\Helper\GlobalFunctionsHelper $globalFunctionsHelper ) : AbstractReader
$globalFunctionsHelper Box\Spout\Common\Helper\GlobalFunctionsHelper
return AbstractReader

setShouldFormatDates() public method

Sets whether date/time values should be returned as PHP objects or be formatted as strings.
public setShouldFormatDates ( boolean $shouldFormatDates ) : AbstractReader
$shouldFormatDates boolean
return AbstractReader

setShouldPreserveEmptyRows() public method

Sets whether empty rows should be returned or skipped.
public setShouldPreserveEmptyRows ( boolean $shouldPreserveEmptyRows ) : AbstractReader
$shouldPreserveEmptyRows boolean
return AbstractReader

Property Details

$globalFunctionsHelper protected property

Helper to work with global functions
protected $globalFunctionsHelper

$isStreamOpened protected property

Indicates whether the stream is currently open
protected $isStreamOpened

$options protected property

Reader's customized options
protected $options