Added getElo() and getId() function

This commit is contained in:
Jeroen De Meerleer 2019-05-29 18:09:19 +02:00
parent d033c10ebf
commit 97a28a3c4d
Signed by: JeroenED
GPG Key ID: 28CCCB8F62BFADD6
3 changed files with 51 additions and 7 deletions

View File

@ -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

View File

@ -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;
}
}

View File

@ -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;