/**
  * Calculate points and put in table.
  *
  * @method calcuate
  * @private
  */
 private function calculate()
 {
     $ResultGet = new ResultGet(true);
     $results = $ResultGet->call(array('tournament_id' => $this->data['id']))['results'];
     foreach ($results as &$result) {
         $points1 = 0;
         $points2 = 0;
         $this->table[$result['player1_id']]['played'] += 1;
         $this->table[$result['player2_id']]['played'] += 1;
         // Player 1 wins.
         if ($result['score1'] == 3) {
             $points1 = 6 - $result['score2'];
             $points2 = 1 + $result['score2'];
             $this->table[$result['player1_id']]['wins'] += 1;
             $this->table[$result['player2_id']]['loses'] += 1;
         } else {
             if ($result['score2'] == 3) {
                 $points1 = 1 + $result['score1'];
                 $points2 = 6 - $result['score1'];
                 $this->table[$result['player2_id']]['wins'] += 1;
                 $this->table[$result['player1_id']]['loses'] += 1;
             }
         }
         // Add points to total.
         $this->table[$result['player1_id']]['points'] += $points1;
         $this->table[$result['player2_id']]['points'] += $points2;
     }
 }
 /**
  * Method that gets the result data from @class ResultGet.
  *
  * @method getResult
  * @private
  */
 private function getResult()
 {
     $ResultGet = new ResultGet(true);
     $this->result_data = $ResultGet->call(array('result_id' => $this->data['id']))['results'][0];
 }