mirror of
https://github.com/JeroenED/libpairtwo.git
synced 2024-12-25 22:00:58 +01:00
Models in Models, logic in src
This commit is contained in:
parent
911c9615fd
commit
dd5dee63e9
16
src/Player.php
Normal file
16
src/Player.php
Normal 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
|
||||
{
|
||||
|
||||
}
|
@ -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
33
src/Tournament.php
Normal 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);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user