本文整理匯總了PHP中Step::previousStep方法的典型用法代碼示例。如果您正苦於以下問題:PHP Step::previousStep方法的具體用法?PHP Step::previousStep怎麽用?PHP Step::previousStep使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Step
的用法示例。
在下文中一共展示了Step::previousStep方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: previousRound
/**
* 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})");
}
}
}