refactored scoressstructures

This commit is contained in:
kremsy 2017-03-30 19:40:10 +02:00
parent e9ed9d910c
commit 191235b246
2 changed files with 1 additions and 24 deletions

View File

@ -23,18 +23,6 @@ class OnScoresStructure extends CommonScoresStructure {
$jsonObj = $this->getPlainJsonObject(); $jsonObj = $this->getPlainJsonObject();
foreach ($jsonObj->teams as $team) {
//if($this instanceof OnScoresStructure)
$teamScore = new TeamScore();
$teamScore->setId($team->id);
$teamScore->setName($team->name);
$teamScore->setRoundPoints($team->roundpoints);
$teamScore->setMatchPoints($team->matchpoints);
$teamScore->setMapPoints($team->mappoints);
$this->teamScores[$team->id] = $teamScore; //TODO verify that different teams have different ids
}
foreach ($jsonObj->players as $jsonPlayer) { foreach ($jsonObj->players as $jsonPlayer) {
$playerScore = new PlayerScore(); $playerScore = new PlayerScore();
$playerScore->setPlayer($this->maniaControl->getPlayerManager()->getPlayer($jsonPlayer->login)); $playerScore->setPlayer($this->maniaControl->getPlayerManager()->getPlayer($jsonPlayer->login));

View File

@ -20,18 +20,7 @@ class OnScoresStructure extends CommonScoresStructure {
parent::__construct($maniaControl, $data); parent::__construct($maniaControl, $data);
$jsonObj = $this->getPlainJsonObject(); $jsonObj = $this->getPlainJsonObject();
foreach ($jsonObj->teams as $team) {
$teamScore = new TeamScore();
$teamScore->setId($team->id);
$teamScore->setName($team->name);
$teamScore->setRoundPoints($team->roundpoints);
$teamScore->setMatchPoints($team->matchpoints);
$teamScore->setMapPoints($team->mappoints);
$this->teamScores[$team->id] = $teamScore; //TODO verify that different teams have different ids
}
foreach ($jsonObj->players as $jsonPlayer) { foreach ($jsonObj->players as $jsonPlayer) {
$playerScore = new PlayerScore(); $playerScore = new PlayerScore();
$playerScore->setPlayer($this->maniaControl->getPlayerManager()->getPlayer($jsonPlayer->login)); $playerScore->setPlayer($this->maniaControl->getPlayerManager()->getPlayer($jsonPlayer->login));