本文整理汇总了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})");
}
}
}