Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 3.9.x will end* 10 May 2021 (12 months).
  • Bug fixes for security issues in 3.9.x will end* 8 May 2023 (36 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

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

(no description)

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

Defines 1 class


Class: CellValueFormatter  - X-Ref

Class CellValueFormatter
This class provides helper functions to format cell values

__construct($shouldFormatDates, $escaper)   X-Ref

param: bool $shouldFormatDates Whether date/time values should be returned as PHP objects or be formatted as strings
param: \Box\Spout\Common\Helper\Escaper\ODS $escaper Used to unescape XML data

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

param: \DOMNode $node
return: string|int|float|bool|\DateTime|\DateInterval The value associated with the cell, empty string if cell's type is void/undefined

formatStringCellValue($node)   X-Ref
Returns the cell String value.

param: \DOMNode $node
return: string The value associated with the cell

formatFloatCellValue($node)   X-Ref
Returns the cell Numeric value from the given node.

param: \DOMNode $node
return: int|float The value associated with the cell

formatBooleanCellValue($node)   X-Ref
Returns the cell Boolean value from the given node.

param: \DOMNode $node
return: bool The value associated with the cell

formatDateCellValue($node)   X-Ref
Returns the cell Date value from the given node.

param: \DOMNode $node
return: \DateTime|string The value associated with the cell

formatTimeCellValue($node)   X-Ref
Returns the cell Time value from the given node.

param: \DOMNode $node
return: \DateInterval|string The value associated with the cell

formatCurrencyCellValue($node)   X-Ref
Returns the cell Currency value from the given node.

param: \DOMNode $node
return: string The value associated with the cell (e.g. "100 USD" or "9.99 EUR")

formatPercentageCellValue($node)   X-Ref
Returns the cell Percentage value from the given node.

param: \DOMNode $node
return: int|float The value associated with the cell