abstract class IOFactory (View source)

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.

Methods

static IWriter
createWriter(Spreadsheet $spreadsheet, string $writerType)

Create Writer\IWriter.

static IReader
createReader(string $readerType)

Create Reader\IReader.

static Spreadsheet
load(string $pFilename)

Loads Spreadsheet from file using automatic Reader\IReader resolution.

static string
identify(string $pFilename)

Identify file type using automatic Reader\IReader resolution.

static IReader
createReaderForFile(string $filename)

Create Reader\IReader for file using automatic Reader\IReader resolution.

static 
registerWriter(string $writerType, string $writerClass)

Register a writer with its type and class name.

static 
registerReader(string $readerType, string $readerClass)

Register a reader with its type and class name.

Details

static IWriter createWriter(Spreadsheet $spreadsheet, string $writerType)

Create Writer\IWriter.

Parameters

Spreadsheet $spreadsheet
string $writerType Example: Xlsx

Return Value

IWriter

Exceptions

Exception

static IReader createReader(string $readerType)

Create Reader\IReader.

Parameters

string $readerType Example: Xlsx

Return Value

IReader

Exceptions

Exception

static Spreadsheet load(string $pFilename)

Loads Spreadsheet from file using automatic Reader\IReader resolution.

Parameters

string $pFilename The name of the spreadsheet file

Return Value

Spreadsheet

Exceptions

Exception

static string identify(string $pFilename)

Identify file type using automatic Reader\IReader resolution.

Parameters

string $pFilename The name of the spreadsheet file to identify

Return Value

string

Exceptions

Exception

static IReader createReaderForFile(string $filename)

Create Reader\IReader for file using automatic Reader\IReader resolution.

Parameters

string $filename The name of the spreadsheet file

Return Value

IReader

Exceptions

Exception

static registerWriter(string $writerType, string $writerClass)

Register a writer with its type and class name.

Parameters

string $writerType
string $writerClass

static registerReader(string $readerType, string $readerClass)

Register a reader with its type and class name.

Parameters

string $readerType
string $readerClass