Example #1
0
 /**
  * Basic OPF values
  */
 public function testBasicOpf()
 {
     $this->assertInstanceOf('Hametuha\\HamePub\\Oebps\\Content', $this->content);
     // Set identifier and language
     $this->content->setIdentifier('http://hametuha.com');
     $this->content->setLang('en_US');
     // Set meta data
     // title
     $this->content->addMeta('dc:title', 'ePub by Hametuha');
     // schema
     $this->content->addMeta('dc:creator', 'Takahashi Fumiki', ['id' => 'creator']);
     $this->content->addMeta('meta', Marc::AUTHOR, ['refines' => '#creator', 'property' => 'role', 'scheme' => Marc::getSchema(), 'id' => 'role']);
     // Add items
     $this->content->addItem('Documents/nav.xhtml', 'nav.xhtml', ['nav']);
     $this->content->addItem('Documents/chapter1.xhtml', 'chapter1.xhtml');
     $this->content->addItem('Images/images/fig2.jpg', 'fig2.jpg');
     // Check file is output
     $out = $this->content->putXML();
     $this->assertFileExists($out);
     $this->assertXmlFileEqualsXmlFile($this->asset_dir . DIRECTORY_SEPARATOR . 'content-meta-only.opf', $out);
 }
Example #2
0
 /**
  * @param string $name
  *
  * @return mixed|null
  * @throws SettingException
  */
 public function __get($name)
 {
     switch ($name) {
         case 'container':
             $class_name = 'Hametuha\\HamePub\\MetaInf\\' . ucfirst($name);
             return $class_name::get($this->id);
             break;
         case 'parser':
             return HTML5Parser::get($this->id);
             break;
         case 'opf':
             return Content::get($this->id);
             break;
         case 'toc':
             return Toc::get($this->id) ?: Toc::init($this->id, 'Index');
             break;
         case 'distributor':
             return Distributor::get($this->id);
             break;
         default:
             return null;
             break;
     }
 }