Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.2.x will end 22 April 2024 (12 months).
  • Bug fixes for security issues in 4.2.x will end 7 October 2024 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.1.x is supported too.

Differences Between: [Versions 402 and 403]

(no description)

File Size: 415 lines (15 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: RowIterator  - X-Ref

__construct(string $filePath,string $sheetDataXMLFilePath,bool $shouldPreserveEmptyRows,XMLReader $xmlReader,XMLProcessor $xmlProcessor,CellValueFormatter $cellValueFormatter,RowManager $rowManager)   X-Ref

param: string             $filePath                Path of the XLSX file being read
param: string             $sheetDataXMLFilePath    Path of the sheet data XML file as in [Content_Types].xml
param: bool               $shouldPreserveEmptyRows Whether empty rows should be preserved
param: XMLReader          $xmlReader               XML Reader
param: XMLProcessor       $xmlProcessor            Helper to process XML files
param: CellValueFormatter $cellValueFormatter      Helper to format cell values
param: RowManager         $rowManager              Manages rows

rewind()   X-Ref
Rewind the Iterator to the first element.
Initializes the XMLReader object that reads the associated sheet data.
The XMLReader is configured to be safe from billion laughs attack.


valid()   X-Ref
Checks if current position is valid.


next()   X-Ref
Move forward to next element. Reads data describing the next unprocessed row.


current()   X-Ref
Return the current element, either an empty row or from the buffer.


key()   X-Ref
Return the key of the current element. Here, the row index.


normalizeSheetDataXMLFilePath(string $sheetDataXMLFilePath)   X-Ref

param: string $sheetDataXMLFilePath Path of the sheet data XML file as in [Content_Types].xml
return: string path of the XML file containing the sheet data,

doesNeedDataForNextRowToBeProcessed()   X-Ref
Returns whether we need data for the next row to be processed.
We don't need to read data if:
we have already read at least one row
AND
we need to preserve empty rows
AND
the last row that was read is not the row that need to be processed
(i.e. if we need to return empty rows).

return: bool whether we need data for the next row to be processed

readDataForNextRow()   X-Ref


processDimensionStartingNode(XMLReader $xmlReader)   X-Ref

param: XMLReader $xmlReader XMLReader object, positioned on a "<dimension>" starting node
return: int A return code that indicates what action should the processor take next

processRowStartingNode(XMLReader $xmlReader)   X-Ref

param: XMLReader $xmlReader XMLReader object, positioned on a "<row>" starting node
return: int A return code that indicates what action should the processor take next

processCellStartingNode(XMLReader $xmlReader)   X-Ref

param: XMLReader $xmlReader XMLReader object, positioned on a "<cell>" starting node
return: int A return code that indicates what action should the processor take next

processRowEndingNode()   X-Ref

return: int A return code that indicates what action should the processor take next

processWorksheetEndingNode()   X-Ref

return: int A return code that indicates what action should the processor take next

getRowIndex(XMLReader $xmlReader)   X-Ref

param: XMLReader $xmlReader XMLReader object, positioned on a "<row>" node
return: int Row index

getColumnIndex(XMLReader $xmlReader)   X-Ref

param: XMLReader $xmlReader XMLReader object, positioned on a "<c>" node
return: int Column index

getCell(DOMElement $node)   X-Ref
Returns the cell with (unescaped) correctly marshalled, cell value associated to the given XML node.

return: Cell The cell set with the associated with the cell