Moodle PHP Documentation 4.1
Moodle 4.1.19+ (Build: 20250711) (5f47dc23ffc)
Box\Spout\Reader\XLSX\Reader Class Reference
Inheritance diagram for Box\Spout\Reader\XLSX\Reader:
Box\Spout\Reader\ReaderAbstract Box\Spout\Reader\ReaderInterface

Public Member Functions

 __construct (OptionsManagerInterface $optionsManager, GlobalFunctionsHelper $globalFunctionsHelper, InternalEntityFactoryInterface $entityFactory, ManagerFactory $managerFactory)
 
 close ()
 Closes the reader, preventing any additional reading.
 
 getSheetIterator ()
 Returns an iterator to iterate over sheets.
 
 open ($filePath)
 Prepares the reader to read the given file.
 
 setShouldFormatDates ($shouldFormatDates)
 Sets whether date/time values should be returned as PHP objects or be formatted as strings.
 
 setShouldPreserveEmptyRows ($shouldPreserveEmptyRows)
 Sets whether empty rows should be returned or skipped.
 
 setTempFolder ($tempFolder)
 

Protected Member Functions

 closeReader ()
 Closes the reader.
 
 doesSupportStreamWrapper ()
 Returns whether stream wrappers are supported.
 
 getConcreteSheetIterator ()
 Returns an iterator to iterate over sheets.
 
 getFileRealPath ($filePath)
 Returns the real path of the given path.
 
 getStreamWrapperScheme ($filePath)
 Returns the scheme of the custom stream wrapper, if the path indicates a stream wrapper is used.
 
 isPhpStream ($filePath)
 Checks if a path is a PHP stream (like php://output, php://memory, ...)
 
 isStreamWrapper ($filePath)
 Checks if the given path is an unsupported stream wrapper (like local path, php://temp, mystream://foo/bar...).
 
 isSupportedStreamWrapper ($filePath)
 Checks if the given path is an supported stream wrapper (like php://temp, mystream://foo/bar...).
 
 openReader ($filePath)
 Opens the file at the given file path to make it ready to be read.
 

Protected Attributes

InternalEntityFactoryInterface $entityFactory
 Factory to create entities.
 
Box Spout Common Helper GlobalFunctionsHelper $globalFunctionsHelper
 Helper to work with global functions.
 
bool $isStreamOpened = false
 Indicates whether the stream is currently open.
 
ManagerFactory $managerFactory
 
OptionsManagerInterface $optionsManager
 Writer options manager.
 
Box Spout Reader XLSX Manager SharedStringsManager $sharedStringsManager
 Manages shared strings.
 
SheetIterator $sheetIterator
 To iterator over the XLSX sheets.
 
ZipArchive $zip
 

Constructor & Destructor Documentation

◆ __construct()

Box\Spout\Reader\XLSX\Reader::__construct ( OptionsManagerInterface $optionsManager,
GlobalFunctionsHelper $globalFunctionsHelper,
InternalEntityFactoryInterface $entityFactory,
ManagerFactory $managerFactory )
Parameters
OptionsManagerInterface$optionsManager
GlobalFunctionsHelper$globalFunctionsHelper
InternalEntityFactoryInterface$entityFactory
ManagerFactory$managerFactory

Member Function Documentation

◆ close()

Box\Spout\Reader\ReaderAbstract::close ( )
inherited

Closes the reader, preventing any additional reading.

Return values
void

Implements Box\Spout\Reader\ReaderInterface.

◆ closeReader()

Box\Spout\Reader\XLSX\Reader::closeReader ( )
protected

Closes the reader.

To be used after reading the file.

Return values
void

Reimplemented from Box\Spout\Reader\ReaderAbstract.

◆ doesSupportStreamWrapper()

Box\Spout\Reader\XLSX\Reader::doesSupportStreamWrapper ( )
protected

Returns whether stream wrappers are supported.

Return values
bool

Reimplemented from Box\Spout\Reader\ReaderAbstract.

◆ getConcreteSheetIterator()

Box\Spout\Reader\XLSX\Reader::getConcreteSheetIterator ( )
protected

Returns an iterator to iterate over sheets.

Return values
SheetIteratorTo iterate over sheets

Reimplemented from Box\Spout\Reader\ReaderAbstract.

◆ getFileRealPath()

Box\Spout\Reader\ReaderAbstract::getFileRealPath ( $filePath)
protectedinherited

Returns the real path of the given path.

If the given path is a valid stream wrapper, returns the path unchanged.

Parameters
string$filePath
Return values
string

◆ getSheetIterator()

Box\Spout\Reader\ReaderAbstract::getSheetIterator ( )
inherited

Returns an iterator to iterate over sheets.

Exceptions
Box\Spout\Reader\Exception\ReaderNotOpenedExceptionIf called before opening the reader
Return values
IteratorTo iterate over sheets

Implements Box\Spout\Reader\ReaderInterface.

◆ getStreamWrapperScheme()

Box\Spout\Reader\ReaderAbstract::getStreamWrapperScheme ( $filePath)
protectedinherited

Returns the scheme of the custom stream wrapper, if the path indicates a stream wrapper is used.

For example, php://temp => php, s3://path/to/file => s3...

Parameters
string$filePathPath of the file to be read
Return values
string|nullThe stream wrapper scheme or NULL if not a stream wrapper

◆ isPhpStream()

Box\Spout\Reader\ReaderAbstract::isPhpStream ( $filePath)
protectedinherited

Checks if a path is a PHP stream (like php://output, php://memory, ...)

Parameters
string$filePathPath of the file to be read
Return values
boolWhether the given path maps to a PHP stream

◆ isStreamWrapper()

Box\Spout\Reader\ReaderAbstract::isStreamWrapper ( $filePath)
protectedinherited

Checks if the given path is an unsupported stream wrapper (like local path, php://temp, mystream://foo/bar...).

Parameters
string$filePathPath of the file to be read
Return values
boolWhether the given path is an unsupported stream wrapper

◆ isSupportedStreamWrapper()

Box\Spout\Reader\ReaderAbstract::isSupportedStreamWrapper ( $filePath)
protectedinherited

Checks if the given path is an supported stream wrapper (like php://temp, mystream://foo/bar...).

If the given path is a local path, returns true.

Parameters
string$filePathPath of the file to be read
Return values
boolWhether the given path is an supported stream wrapper

◆ open()

Box\Spout\Reader\ReaderAbstract::open ( $filePath)
inherited

Prepares the reader to read the given file.

It also makes sure that the file exists and is readable.

Parameters
string$filePathPath of the file to be read
Exceptions
Box\Spout\Common\Exception\IOExceptionIf the file at the given path does not exist, is not readable or is corrupted
Return values
void

Implements Box\Spout\Reader\ReaderInterface.

◆ openReader()

Box\Spout\Reader\XLSX\Reader::openReader ( $filePath)
protected

Opens the file at the given file path to make it ready to be read.

It also parses the sharedStrings.xml file to get all the shared strings available in memory and fetches all the available sheets.

Parameters
string$filePathPath of the file to be read
Exceptions
Box\Spout\Common\Exception\IOExceptionIf the file at the given path or its content cannot be read
Box\Spout\Reader\Exception\NoSheetsFoundExceptionIf there are no sheets in the file
Return values
void

Reimplemented from Box\Spout\Reader\ReaderAbstract.

◆ setShouldFormatDates()

Box\Spout\Reader\ReaderAbstract::setShouldFormatDates ( $shouldFormatDates)
inherited

Sets whether date/time values should be returned as PHP objects or be formatted as strings.

Parameters
bool$shouldFormatDates
Return values
ReaderAbstract

◆ setShouldPreserveEmptyRows()

Box\Spout\Reader\ReaderAbstract::setShouldPreserveEmptyRows ( $shouldPreserveEmptyRows)
inherited

Sets whether empty rows should be returned or skipped.

Parameters
bool$shouldPreserveEmptyRows
Return values
ReaderAbstract

◆ setTempFolder()

Box\Spout\Reader\XLSX\Reader::setTempFolder ( $tempFolder)
Parameters
string$tempFolderTemporary folder where the temporary files will be created
Return values
Reader

The documentation for this class was generated from the following file: