Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.

Differences Between: [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

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

processCellStartingNode($xmlReader)   X-Ref

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

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

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

getNumColumnsRepeatedForCurrentNode($xmlReader)   X-Ref

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

getCell($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
param: \DOMNode $node

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).

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

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