diff --git a/src/Models/Player.php b/src/Models/Player.php index 33e08c5..216b56b 100644 --- a/src/Models/Player.php +++ b/src/Models/Player.php @@ -68,7 +68,7 @@ abstract class Player } /** - * @return int[] + * @return string[] */ public function getIds(): array { @@ -76,7 +76,7 @@ abstract class Player } /** - * @param int[] $Ids + * @param string[] $Ids * @return Player */ public function setIds(array $Ids): Player diff --git a/src/Player.php b/src/Player.php index 6b63f65..8096861 100644 --- a/src/Player.php +++ b/src/Player.php @@ -52,4 +52,48 @@ class Player extends PlayerModel return $return; } + + /** + * @param string $type + * @return int + */ + public function getElo(string $type): int + { + return $this->getElos()[$type]; + } + + /** + * @param string $type + * @param int $value + * @return Player + */ + public function setElo(string $type, int $value): Player + { + $currentElos = $this->getElos(); + $currentElos[$type] = $value; + $this->setElos($currentElos); + return $this; + } + + /** + * @param string $type + * @return string + */ + public function getId(string $type): string + { + return $this->getElos()[$type]; + } + + /** + * @param string $type + * @param string $value + * @return Player + */ + public function setId(string $type, string $value): Player + { + $currentIds = $this->getIds(); + $currentIds[$type] = $value; + $this->setIds($currentIds); + return $this; + } } diff --git a/src/Readers/Pairtwo6.php b/src/Readers/Pairtwo6.php index 558949d..4f3b88d 100644 --- a/src/Readers/Pairtwo6.php +++ b/src/Readers/Pairtwo6.php @@ -306,7 +306,7 @@ class Pairtwo6 extends Pairtwo6Model implements ReaderInterface $offset += $length; $length = 4; - $ids['world'] = $this->readData('Int', substr($swscontents, $offset, $length)); + $player->setId('world', $this->readData('Int', substr($swscontents, $offset, $length) . "")); $offset += $length; $length = 4; @@ -314,7 +314,7 @@ class Pairtwo6 extends Pairtwo6Model implements ReaderInterface $offset += $length; $length = 4; - $elos['home'] = $this->readData('Int', substr($swscontents, $offset, $length)); + $player->setElo('home', $this->readData('Int', substr($swscontents, $offset, $length))); $offset += $length; $length = 4; @@ -322,7 +322,7 @@ class Pairtwo6 extends Pairtwo6Model implements ReaderInterface $offset += $length; $length = 4; - $ids['home'] = $this->readData('Int', substr($swscontents, $offset, $length)); + $player->setId('home', $this->readData('Int', substr($swscontents, $offset, $length))); $offset += $length; $length = 4; @@ -330,7 +330,7 @@ class Pairtwo6 extends Pairtwo6Model implements ReaderInterface $offset += $length; $length = 4; - $ids['club'] = $this->readData('Int', substr($swscontents, $offset, $length)); + $player->setId('club', $this->readData('Int', substr($swscontents, $offset, $length))); $offset += $length; $length = 4; @@ -346,7 +346,7 @@ class Pairtwo6 extends Pairtwo6Model implements ReaderInterface $offset += $length; $length = 4; - $elos['world'] = $this->readData('Int', substr($swscontents, $offset, $length)); + $player->setElo('world', $this->readData('Int', substr($swscontents, $offset, $length))); $offset += $length; $length = 1;