From 44007a266f15fad82dc2d4bf3904debacd8691e7 Mon Sep 17 00:00:00 2001 From: Jeroen De Meerleer Date: Wed, 5 Jun 2019 16:02:22 +0200 Subject: [PATCH] Created 4. Writing your own reader (markdown) --- 4.-Writing-your-own-reader.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 4.-Writing-your-own-reader.md diff --git a/4.-Writing-your-own-reader.md b/4.-Writing-your-own-reader.md new file mode 100644 index 0000000..5d78223 --- /dev/null +++ b/4.-Writing-your-own-reader.md @@ -0,0 +1,16 @@ +Libpairtwo has built in several readers for different pairing application. However, you might be using an excel file for your competition or you might have built your own application. Libpairtwo provides an interface that enables your to use that file with libpairtwo without the need to make a pull request to the main repository. + +## The basics + +To start creating your own reader, you can easily start with [the reader boilerplate](https://github.com/JeroenED/libpairtwo/wiki/e.-Reader-boilerplate). This provides all required methods and probably all required use statements you'll need. + +Within the `MyReader::read` method you should place all your code that reads out your excel file, xml code, etc. Whenever you have a field that should be included for reading out to your application, you can set the with `Class::setProperty('value')` where `Class::getProperty()` should be the getter for the same field. + +To add players, pairings and other items that should not be alone you can use the `Tournament::AddPlayer($player)` method (example: to add a player). + +If your created implementation does not generate rounds, you can easily generate these by calling the `Tournament::pairingsToRounds()` method + +## Examples of readers + +You can find some readers in the [src/Readers](https://github.com/JeroenED/libpairtwo/tree/master/src/Readers) of our repository. +