Exemplo n.º 1
0
 /**
  * @param int  $teamNumber
  * @param Team $team
  */
 protected function setTeam($teamNumber, Team $team)
 {
     switch ($teamNumber) {
         case 1:
             $fieldAttack = 'teamOneAttack';
             $fieldDefence = 'teamOneDefence';
             break;
         case 2:
             $fieldAttack = 'teamTwoAttack';
             $fieldDefence = 'teamTwoDefence';
             break;
     }
     $options = array($team->getPlayer1()->getId() => $team->getPlayer1()->getName(), $team->getPlayer2()->getId() => $team->getPlayer2()->getName());
     $this->get($fieldAttack)->setValueOptions($options);
     $this->get($fieldAttack)->setValue($team->getPlayer1()->getId());
     $this->get($fieldDefence)->setValueOptions($options);
     $this->get($fieldDefence)->setValue($team->getPlayer2()->getId());
 }
Exemplo n.º 2
0
 /**
  * @param Team $team
  *
  * @return float
  */
 protected function getPointsForTeam($team)
 {
     $sum = $team->getAttackingPlayer()->getPoints() + $team->getDefendingPlayer()->getPoints();
     return round($sum / 2);
 }