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.

(no description)

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

Defines 1 class


Class: StyleManager  - X-Ref

__construct(string $filePath, ?string $stylesXMLFilePath)   X-Ref

param: string  $filePath          Path of the XLSX file being read
param: ?string $stylesXMLFilePath

shouldFormatNumericValueAsDate(int $styleId)   X-Ref
No description

getNumberFormatCode(int $styleId)   X-Ref
No description

getCustomNumberFormats()   X-Ref

return: array<int, string> The custom number formats

getStylesAttributes()   X-Ref

return: array<array-key, array<string, null|bool|int>> The styles attributes

extractRelevantInfo()   X-Ref
Reads the styles.xml file and extract the relevant information from the file.


extractNumberFormats(XMLReader $xmlReader)   X-Ref
Extracts number formats from the "numFmt" nodes.
For simplicity, the styles attributes are kept in memory. This is possible thanks
to the reuse of formats. So 1 million cells should not use 1 million formats.

param: \OpenSpout\Reader\Wrapper\XMLReader $xmlReader XML Reader positioned on the "numFmts" node

extractStyleAttributes(XMLReader $xmlReader)   X-Ref
Extracts style attributes from the "xf" nodes, inside the "cellXfs" section.
For simplicity, the styles attributes are kept in memory. This is possible thanks
to the reuse of styles. So 1 million cells should not use 1 million styles.

param: \OpenSpout\Reader\Wrapper\XMLReader $xmlReader XML Reader positioned on the "cellXfs" node

doesStyleIndicateDate(array $styleAttributes)   X-Ref

param: array<string, null|bool|int> $styleAttributes Array containing the style attributes (2 keys: "applyNumberFormat" and "numFmtId")
return: bool Whether the style with the given attributes indicates that the number is a date

doesNumFmtIdIndicateDate(int $numFmtId)   X-Ref
Returns whether the number format ID indicates that the number is a date.
The result is cached to avoid recomputing the same thing over and over, as
"numFmtId" attributes can be shared between multiple styles.

return: bool Whether the number format ID indicates that the number is a date

getFormatCodeForNumFmtId(int $numFmtId)   X-Ref

return: null|string The custom number format or NULL if none defined for the given numFmtId

isNumFmtIdBuiltInDateFormat(int $numFmtId)   X-Ref

return: bool Whether the number format ID indicates that the number is a date

isFormatCodeCustomDateFormat(?string $formatCode)   X-Ref

return: bool Whether the given format code indicates that the number is a date

isFormatCodeMatchingDateFormatPattern(string $formatCode)   X-Ref

return: bool Whether the given format code matches a date format pattern