Exemplo n.º 1
0
 /**
  * @param array $data
  * @param FileHandler $fileHandler
  * @param NcxRenderer $ncxRenderer
  * @param OpfRenderer $opfRenderer
  */
 public function __construct($data = array(), FileHandler $fileHandler = null, NcxRenderer $ncxRenderer = null, OpfRenderer $opfRenderer = null, ContentInterface $tableOfContents = null)
 {
     $this->attributes = $data;
     $this->htmlHelper = false;
     $this->content = array();
     if (is_null($fileHandler)) {
         $this->createFileHandler();
     } else {
         $this->fileHandler = $fileHandler;
     }
     //todo: this shouldn't be here, consider passing in as a parameter?
     $htmlHelper = new HtmlHelper();
     $htmlHelper->setAbsoluteStaticResourcePath($this->getAttribute('staticResourcePath'));
     $htmlHelper->setTempDirectory($this->fileHandler->getTempPath());
     $htmlHelper->setDownloadImages($this->getAttribute('downloadImages'));
     //will default to false if not set
     $this->htmlHelper = $htmlHelper;
     if (is_null($opfRenderer)) {
         $this->opfRenderer = new OpfRenderer(new Templatish(), $htmlHelper);
     }
     if (is_null($ncxRenderer)) {
         $this->ncxRenderer = new NcxRenderer(new Templatish());
     }
     if (is_null($tableOfContents)) {
         $this->toc = new TableOfContents(new Templatish(), $htmlHelper);
     }
 }