Models in Models, logic in src

This commit is contained in:
Jeroen De Meerleer 2019-02-01 15:53:39 +01:00
parent 97044491f4
commit a71b77edd5
Signed by: JeroenED
GPG Key ID: 28CCCB8F62BFADD6
3 changed files with 53 additions and 3 deletions

16
src/Player.php Normal file
View File

@ -0,0 +1,16 @@
<?php
/**
* Created by PhpStorm.
* User: jeroen
* Date: 1/02/19
* Time: 11:26
*/
namespace JeroenED\LibPairtwo;
use JeroenED\Libpairtwo\Models\Player as PlayerModel;
class Player Extends PlayerModel
{
}

View File

@ -28,6 +28,7 @@ namespace JeroenED\Libpairtwo;
use JeroenED\Libpairtwo\Enums\Title;
use JeroenED\Libpairtwo\Enums\Sex;
use JeroenED\Libpairtwo\Models\Sws as SwsModel;
use JeroenED\Libpairtwo\Enums\TournamentSystem;
/**
@ -35,7 +36,7 @@ use JeroenED\Libpairtwo\Enums\TournamentSystem;
*
* @author Jeroen De Meerleer
*/
class Sws
class Sws extends SwsModel
{
private const PT_DAYFACTOR = 32;
private const PT_MONTHFACTOR = 16;
@ -46,7 +47,7 @@ class Sws
/**
* @param string $swsfile
* @return MyModel
* @return SwsModel
*/
public static function ReadSws(string $swsfile)
{
@ -54,7 +55,7 @@ class Sws
$swscontents = fread($swshandle, filesize($swsfile));
fclose($swshandle);
$sws = new MyModel();
$sws = new SwsModel();
$offset = 0;

33
src/Tournament.php Normal file
View File

@ -0,0 +1,33 @@
<?php
/**
* Created by PhpStorm.
* User: jeroen
* Date: 1/02/19
* Time: 11:18
*/
namespace JeroenED\Libpairtwo;
use JeroenED\Libpairtwo\Models\Tournament as TournamentModel;
class Tournament extends TournamentModel
{
/**
* @param Integer $id
* @return Player
*/
public function getPlayerById($id)
{
return $this->GetPlayers()[$id];
}
/**
* @param Player $Player
*/
public function addPlayer(Player $Player)
{
$newArray = $this->GetPlayers();
$newArray[] = $Player;
$this->setPlayers($newArray);
}
}