ENHANCE:MENT: Added binary data methods

This commit is contained in:
Jeroen De Meerleer 2023-01-21 15:55:36 +01:00
parent 58ff6714a9
commit 466bb2bfec
Signed by: JeroenED
GPG Key ID: 28CCCB8F62BFADD6
2 changed files with 52 additions and 0 deletions

View File

@ -70,4 +70,38 @@ class Pairing
* @var int * @var int
*/ */
public $Round; 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;
}
} }

View File

@ -56,6 +56,13 @@ class Round
*/ */
public $RoundNo; public $RoundNo;
/**
* 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 * Magic method to read out several fields. If field was not found it is being searched in the binary data fields
* *
@ -78,6 +85,17 @@ class Round
return null; 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;
}
/** /**
* Returns an array of pairings where the player is absent * Returns an array of pairings where the player is absent
* *