Merge branch 'task/getids-getelos' into develop

This commit is contained in:
Jeroen De Meerleer 2019-05-29 18:24:28 +02:00
commit a2842a24d2
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 public function getIds(): array
{ {
@ -76,7 +76,7 @@ abstract class Player
} }
/** /**
* @param int[] $Ids * @param string[] $Ids
* @return Player * @return Player
*/ */
public function setIds(array $Ids): Player public function setIds(array $Ids): Player

View File

@ -52,4 +52,48 @@ class Player extends PlayerModel
return $return; 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; $offset += $length;
$length = 4; $length = 4;
$ids['world'] = $this->readData('Int', substr($swscontents, $offset, $length)); $player->setId('world', $this->readData('Int', substr($swscontents, $offset, $length) . ""));
$offset += $length; $offset += $length;
$length = 4; $length = 4;
@ -314,7 +314,7 @@ class Pairtwo6 extends Pairtwo6Model implements ReaderInterface
$offset += $length; $offset += $length;
$length = 4; $length = 4;
$elos['home'] = $this->readData('Int', substr($swscontents, $offset, $length)); $player->setElo('home', $this->readData('Int', substr($swscontents, $offset, $length)));
$offset += $length; $offset += $length;
$length = 4; $length = 4;
@ -322,7 +322,7 @@ class Pairtwo6 extends Pairtwo6Model implements ReaderInterface
$offset += $length; $offset += $length;
$length = 4; $length = 4;
$ids['home'] = $this->readData('Int', substr($swscontents, $offset, $length)); $player->setId('home', $this->readData('Int', substr($swscontents, $offset, $length)));
$offset += $length; $offset += $length;
$length = 4; $length = 4;
@ -330,7 +330,7 @@ class Pairtwo6 extends Pairtwo6Model implements ReaderInterface
$offset += $length; $offset += $length;
$length = 4; $length = 4;
$ids['club'] = $this->readData('Int', substr($swscontents, $offset, $length)); $player->setId('club', $this->readData('Int', substr($swscontents, $offset, $length)));
$offset += $length; $offset += $length;
$length = 4; $length = 4;
@ -346,7 +346,7 @@ class Pairtwo6 extends Pairtwo6Model implements ReaderInterface
$offset += $length; $offset += $length;
$length = 4; $length = 4;
$elos['world'] = $this->readData('Int', substr($swscontents, $offset, $length)); $player->setElo('world', $this->readData('Int', substr($swscontents, $offset, $length)));
$offset += $length; $offset += $length;
$length = 1; $length = 1;