mirror of
https://github.com/JeroenED/libpairtwo.git
synced 2024-11-24 23:37:41 +01:00
Added getElo() and getId() function
This commit is contained in:
parent
d033c10ebf
commit
97a28a3c4d
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user