From 6e3c972a2c514b5c5667cc1ba21c441785311c01 Mon Sep 17 00:00:00 2001 From: Jeroen De Meerleer Date: Mon, 27 May 2019 12:58:30 +0200 Subject: [PATCH] Added transition page --- ...ing-your-code-to-the-generalized-format.md | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 Converting-your-code-to-the-generalized-format.md diff --git a/Converting-your-code-to-the-generalized-format.md b/Converting-your-code-to-the-generalized-format.md new file mode 100644 index 0000000..1abb48e --- /dev/null +++ b/Converting-your-code-to-the-generalized-format.md @@ -0,0 +1,20 @@ +Currently the project is in the phase of transforming from pairtwo-only to a generalized view for multiple programs. +This makes it relatively easy to add other filetypes. However, this process requires rewriting and renaming some functions. This document is dedicated to these adjustments. + +## `Sws::readSws` renamed to `ReaderInterface::read` + +When you want to read a file, all you need to do is to create an instance of the ReaderInterface and call its read function. This procedure will be the same for any filetype in the library. + +I have created a easy class to get to the right class for your file. This IOFactory class currently only has 1 type which is for Pairtwo (starting from version 6). But there will be added other filetypes as well. + +### Old code +```php +require_once 'vendor/autoload.php'; +$sws = Sws::readSws(''); +``` + +### New code +```php +require_once 'vendor/autoload.php'; +$reader = IOFactory::createReader('Pairtwo-6'); +$sws = $reader->read('');