Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

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

(no description)

File Size: 233 lines (9 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, string $writerType)   X-Ref
Create Writer\IWriter.


createReader(string $readerType)   X-Ref
Create IReader.


load(string $filename, int $flags = 0, ?array $readers = null)   X-Ref
Loads Spreadsheet from file using automatic Reader\IReader resolution.

param: string $filename The name of the spreadsheet file
param: int $flags the optional second parameter flags may be used to identify specific elements
param: string[] $readers An array of Readers to use to identify the file type. By default, load() will try

identify(string $filename, ?array $readers = null)   X-Ref
Identify file type using automatic IReader resolution.


createReaderForFile(string $filename, ?array $readers = null)   X-Ref
Create Reader\IReader for file using automatic IReader resolution.

param: string[] $readers An array of Readers to use to identify the file type. By default, load() will try

getReaderTypeFromExtension(string $filename)   X-Ref
No description

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


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