Beispiel #1
0
 /**
  * @param ChapterName $chapterName
  * @param ChapterTemplate[] $chapterTemplates
  * @throws Exception\Story
  * @return ChapterTemplate
  */
 private function getChapterTemplateByName(ChapterName $chapterName, array &$chapterTemplates)
 {
     foreach ($chapterTemplates as $chapterTemplate) {
         if ($chapterTemplate->desiredChapterName()->equals($chapterName)) {
             return $chapterTemplate;
         }
     }
     throw Exception\Story::cannotFindMatchingTemplateForChapterName($chapterName, $this->name);
 }