예제 #1
0
 /**
  * Returns a new ChapterStatus RUNNING with retry count incremented by 1
  * @return ChapterStatus
  * @throws Exception\ChapterStatus
  */
 public function retry()
 {
     if (!$this->isFailed()) {
         throw Exception\ChapterStatus::isNotFailed($this->status, $this->chapterNumber);
     }
     if ($this->retryLimit === $this->retryCount) {
         throw Exception\ChapterStatus::retryLimitReached($this->retryLimit, $this->chapterNumber);
     }
     return new self($this->chapterName, $this->chapterNumber, self::STATUS_RUNNING, $this->retryCount + 1, $this->retryLimit);
 }
예제 #2
0
파일: Story.php 프로젝트: bweston92/done
 /**
  * @param ChapterNumber $chapterNumber
  * @param ChapterStatus[] $chapterStates
  * @throws Exception\ChapterStatus
  * @return ChapterStatus
  */
 private function getChapterStatusByChapterNumber(ChapterNumber $chapterNumber, array &$chapterStates)
 {
     foreach ($chapterStates as $chapterStatus) {
         if ($chapterNumber->equals($chapterStatus->chapterNumber())) {
             return $chapterStatus;
         }
     }
     throw Exception\ChapterStatus::forChapterNumberCannotBeFound($chapterNumber);
 }