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] [Versions 39 and 402] [Versions 39 and 403]

(no description)

File Size: 228 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: Spreadsheet $spreadsheet
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