diff --git a/CHANGELOG.md b/CHANGELOG.md index 2b66335..d3d8da5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # CHANGELOG ## vx.y.z (Release: aa-bbb-cccc) +* ENHANCEMENT: `Class::getBinaryData` methods return null if field is non-existent * BUGFIX: `Player:GetId` returns elo instead of id ## v1.1.2 (Release: 21-jun-2019) diff --git a/src/Player.php b/src/Player.php index c5a42d8..12d54e7 100644 --- a/src/Player.php +++ b/src/Player.php @@ -464,11 +464,14 @@ class Player * Returns binary data that was read out the pairtwo file but was not needed immediately * * @param string $Key - * @return bool|DateTime|int|string + * @return bool|DateTime|int|string|null */ public function getBinaryData(string $Key) { - return $this->BinaryData[$Key]; + if (isset($this->BinaryData[$Key])) { + return $this->BinaryData[$Key]; + } + return null; } /** diff --git a/src/Readers/Pairtwo6.php b/src/Readers/Pairtwo6.php index a82ee68..87a649e 100644 --- a/src/Readers/Pairtwo6.php +++ b/src/Readers/Pairtwo6.php @@ -103,11 +103,14 @@ class Pairtwo6 implements ReaderInterface * Returns binary data that was read out the pairtwo file but was not needed immediately * * @param string $Key - * @return bool|DateTime|int|string + * @return bool|DateTime|int|string|null */ public function getBinaryData(string $Key) { - return $this->BinaryData[$Key]; + if (isset($this->BinaryData[$Key])) { + return $this->BinaryData[$Key]; + } + return null; } @@ -138,7 +141,7 @@ class Pairtwo6 implements ReaderInterface fclose($swshandle); $offset = 0; - + $length = 4; $this->setRelease($this->readData('String', substr($swscontents, $offset, $length)));