Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

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

(no description)

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

Defines 1 class

IOFactory:: (8 methods):
  createWriter()
  createReader()
  load()
  identify()
  createReaderForFile()
  getReaderTypeFromExtension()
  registerWriter()
  registerReader()


Class: IOFactory  - X-Ref

Factory to create readers and writers easily.

It is not required to use this class, but it should make it easier to read and write files.
Especially for reading files with an unknown format.
createWriter(Spreadsheet $spreadsheet, $writerType)   X-Ref
Create Writer\IWriter.

param: string $writerType Example: Xlsx
return: Writer\IWriter

createReader($readerType)   X-Ref
Create Reader\IReader.

param: string $readerType Example: Xlsx
return: Reader\IReader

load($pFilename)   X-Ref
Loads Spreadsheet from file using automatic Reader\IReader resolution.

param: string $pFilename The name of the spreadsheet file
return: Spreadsheet

identify($pFilename)   X-Ref
Identify file type using automatic Reader\IReader resolution.

param: string $pFilename The name of the spreadsheet file to identify
return: string

createReaderForFile($filename)   X-Ref
Create Reader\IReader for file using automatic Reader\IReader resolution.

param: string $filename The name of the spreadsheet file
return: Reader\IReader

getReaderTypeFromExtension($filename)   X-Ref
Guess a reader type from the file extension, if any.

param: string $filename
return: null|string

registerWriter($writerType, $writerClass)   X-Ref
Register a writer with its type and class name.

param: string $writerType
param: string $writerClass

registerReader($readerType, $readerClass)   X-Ref
Register a reader with its type and class name.

param: string $readerType
param: string $readerClass