Example #1
0
 /**
  * Returns the previous round in the game.
  * If this is a repeated step, then this is the previous repetition of this step
  * (unless this is the first repetition).
  * Otherwise, it is the last repetition of the previous step.
  * 
  * @throws DoesNotExistException if there is no previous step
  * @return Round the previous round
  */
 public function previousRound()
 {
     if ($this->repetition == 0) {
         return new Round($this->step->previousStep(), $this->step->repeat);
     } else {
         if ($this->step->isRepeated()) {
             return new Round($this->step, $this->repetition - 1);
         } else {
             throw new Exception('internal error: this is not a repeated step, so the only legal value for repetition is 0 ' . "(current value is {$this->repetition})");
         }
     }
 }