Пример #1
0
 /**
  * @param Book $book
  * @return BookPage[]|null
  */
 function getBookPages(Book $book)
 {
     $files = call_user_func($this->finders['findBookPageFiles'], $book->getPath() . '/pages');
     $result = new NamedList();
     foreach ($files as $file) {
         $page = new BookPage($this->project, $book, $file, true);
         if ($page->isLoaded()) {
             $result->add($page->getShortName(), $page);
         }
     }
     return $result;
 }
Пример #2
0
 /**
  * @param Project         $project
  * @param Book            $book
  * @param string          $target_path
  * @param string          $locale
  * @param OutputInterface $output
  */
 private function copyBookImages(Project $project, Book $book, $target_path, $locale, OutputInterface $output)
 {
     $book_path = $book->getPath();
     $book_name = $book->getShortName();
     if (is_dir("{$book_path}/images")) {
         $book_images_path = $locale === $project->getDefaultLocale() ? "{$target_path}/assets/images/books/{$book_name}" : "{$target_path}/assets/images/{$locale}/books/{$book_name}";
         Shade::copyDir("{$book_path}/images", $book_images_path, null, function ($path) use(&$output) {
             $output->writeln("{$path} copied");
         });
     }
 }