Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Differences Between: [Versions 310 and 401] [Versions 311 and 401] [Versions 39 and 401] [Versions 400 and 401]

(no description)

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

Defines 1 class


Class: RowIterator  - X-Ref

Class RowIterator

__construct(XMLReader $xmlReader,OptionsManagerInterface $optionsManager,CellValueFormatter $cellValueFormatter,XMLProcessor $xmlProcessor,RowManager $rowManager,InternalEntityFactory $entityFactory)   X-Ref

param: XMLReader $xmlReader XML Reader, positioned on the "<table:table>" element
param: OptionsManagerInterface $optionsManager Reader's options manager
param: CellValueFormatter $cellValueFormatter Helper to format cell values
param: XMLProcessor $xmlProcessor Helper to process XML files
param: RowManager $rowManager Manages rows
param: InternalEntityFactory $entityFactory Factory to create entities

rewind()   X-Ref
Rewind the Iterator to the first element.
NOTE: It can only be done once, as it is not possible to read an XML file backwards.

return: void

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

return: bool

next()   X-Ref
Move forward to next element. Empty rows will be skipped.

return: void

doesNeedDataForNextRowToBeProcessed()   X-Ref
Returns whether we need data for the next row to be processed.
We DO need to read data if:
- we have not read any rows yet
OR
- the next row to be processed immediately follows the last read row

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

readDataForNextRow()   X-Ref

return: void

processRowStartingNode($xmlReader)   X-Ref

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

processCellStartingNode($xmlReader)   X-Ref

param: \Box\Spout\Reader\Wrapper\XMLReader $xmlReader XMLReader object, positioned on a "<table:table-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

processTableEndingNode()   X-Ref

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

getNumRowsRepeatedForCurrentNode($xmlReader)   X-Ref

param: \Box\Spout\Reader\Wrapper\XMLReader $xmlReader XMLReader object, positioned on a "<table:table-row>" starting node
return: int The value of "table:number-rows-repeated" attribute of the current node, or 1 if attribute missing

getNumColumnsRepeatedForCurrentNode($xmlReader)   X-Ref

param: \Box\Spout\Reader\Wrapper\XMLReader $xmlReader XMLReader object, positioned on a "<table:table-cell>" starting node
return: int The value of "table:number-columns-repeated" attribute of the current node, or 1 if attribute missing

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

param: \DOMNode $node
return: Cell The cell set with the associated with the cell

isEmptyRow($currentRow, $lastReadCell)   X-Ref
After finishing processing each cell, a row is considered empty if it contains
no cells or if the last read cell is empty.
After finishing processing each cell, the last read cell is not part of the
row data yet (as we still need to apply the "num-columns-repeated" attribute).

param: Row $currentRow
param: Cell $lastReadCell The last read cell
return: bool Whether the row is empty

current()   X-Ref
Return the current element, from the buffer.

return: Row

key()   X-Ref
Return the key of the current element

return: int

end()   X-Ref
Cleans up what was created to iterate over the object.

return: void