108 lines
2.2 KiB
PHP
108 lines
2.2 KiB
PHP
<?php
|
|
|
|
/**
|
|
* Class Pairing
|
|
*
|
|
* Class for a pairing of the tournament
|
|
*
|
|
* @author Jeroen De Meerleer <schaak@jeroened.be>
|
|
* @category Main
|
|
* @package Libpairtwo
|
|
* @copyright Copyright (c) 2018-2019 Jeroen De Meerleer <schaak@jeroened.be>
|
|
*/
|
|
|
|
namespace Blackbirdchess\Service\Results;
|
|
|
|
use Blackbirdchess\Service\Results\Enums\Color;
|
|
use Blackbirdchess\Service\Results\Enums\Result;
|
|
|
|
/**
|
|
* Class Pairing
|
|
*
|
|
* Class for a pairing of the tournament
|
|
*
|
|
* @author Jeroen De Meerleer <schaak@jeroened.be>
|
|
* @category Main
|
|
* @package Libpairtwo
|
|
* @copyright Copyright (c) 2018-2019 Jeroen De Meerleer <schaak@jeroened.be>
|
|
*/
|
|
class Pairing
|
|
{
|
|
/**
|
|
* The number of the board where the game was held
|
|
*
|
|
* @var int
|
|
*/
|
|
public $Board;
|
|
|
|
/**
|
|
* The color of the player.
|
|
* Possible values are Black and White
|
|
*
|
|
* @var Color
|
|
*/
|
|
public $Color;
|
|
|
|
/**
|
|
* The opponent of player
|
|
*
|
|
* @var Player | null
|
|
*/
|
|
public $Opponent;
|
|
|
|
/**
|
|
* The player of the pairing. Please note this means the pairing was seen from the point of view of this player
|
|
*
|
|
* @var Player | null
|
|
*/
|
|
public $Player;
|
|
|
|
/**
|
|
* The result of the Game. Possible values contain Won, Lost, Draw, Forfait, Bye, etc.
|
|
*
|
|
* @var Result
|
|
*/
|
|
public $Result;
|
|
|
|
/**
|
|
* The round of the game
|
|
*
|
|
* @var int
|
|
*/
|
|
public $Round;
|
|
|
|
/**
|
|
* Binary data that was read out of the pairing file
|
|
*
|
|
* @var bool|DateTime|int|string[]
|
|
*/
|
|
private $BinaryData = [];
|
|
|
|
/**
|
|
* Magic method to read out several fields. If field was not found it is being searched in the binary data fields
|
|
*
|
|
* @param string $key
|
|
*
|
|
* @return bool|DateTime|int|string|null
|
|
*/
|
|
public function __get(string $key)
|
|
{
|
|
if (isset($this->BinaryData[ $key ])) {
|
|
return $this->BinaryData[ $key ];
|
|
}
|
|
|
|
return null;
|
|
}
|
|
|
|
/**
|
|
* Sets binary data that is read out the pairing file but is not needed immediately
|
|
*
|
|
* @param string $key
|
|
* @param bool|int|DateTime|string $value
|
|
*/
|
|
public function __set(string $key, $value): void
|
|
{
|
|
$this->BinaryData[ $key ] = $value;
|
|
}
|
|
}
|