From 466bb2bfec51ed3526985c96714daca71a9335db Mon Sep 17 00:00:00 2001 From: Jeroen De Meerleer Date: Sat, 21 Jan 2023 15:55:36 +0100 Subject: [PATCH] ENHANCE:MENT: Added binary data methods --- src/Pairing.php | 34 ++++++++++++++++++++++++++++++++++ src/Round.php | 18 ++++++++++++++++++ 2 files changed, 52 insertions(+) diff --git a/src/Pairing.php b/src/Pairing.php index 546f0c8..6eca5b0 100644 --- a/src/Pairing.php +++ b/src/Pairing.php @@ -70,4 +70,38 @@ class Pairing * @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; + } } diff --git a/src/Round.php b/src/Round.php index 982c047..83706ee 100644 --- a/src/Round.php +++ b/src/Round.php @@ -56,6 +56,13 @@ class Round */ 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 * @@ -78,6 +85,17 @@ class Round 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 *