File tree Expand file tree Collapse file tree 4 files changed +13
-7
lines changed
Expand file tree Collapse file tree 4 files changed +13
-7
lines changed Original file line number Diff line number Diff line change 22 "name" : " espresso-tutorials/php-epub" ,
33 "type" : " library" ,
44 "license" : " ISC" ,
5- "version" : " 0.1 .0" ,
5+ "version" : " 0.2 .0" ,
66 "autoload" : {
77 "psr-4" : {
88 "EspressoTutorials\\ Epub\\ " : " src/"
Original file line number Diff line number Diff line change 66
77class Container
88{
9+ protected SimpleXMLElement $ element ;
10+
911 protected ?RootFile $ rootFile = null ;
1012
1113 public function __construct (
12- protected SimpleXMLElement $ element ,
14+ protected string $ file ,
1315 ) {
16+ $ this ->element = SimpleXMLElement::fromPath ($ this ->file );
1417 }
1518
1619 public function rootFile (): RootFile
@@ -20,7 +23,7 @@ public function rootFile(): RootFile
2023 }
2124
2225 return $ this ->rootFile = new RootFile (
23- ( string ) $ this ->element ->rootfiles ->rootfile ->attributes ()['full-path ' ]
26+ dirname ( $ this -> file , 2 ) . ' / ' . ( string ) $ this ->element ->rootfiles ->rootfile ->attributes ()['full-path ' ],
2427 );
2528 }
2629}
Original file line number Diff line number Diff line change 77
88class Content
99{
10+ protected SimpleXMLElement $ element ;
11+
1012 protected array $ manifest = [];
1113
1214 protected array $ spine = [];
1315
1416 public function __construct (
15- protected SimpleXMLElement $ element
17+ protected string $ file
1618 ) {
19+ $ this ->element = SimpleXMLElement::fromPath ($ this ->file );
1720 }
1821
1922 public function manifest (): array
@@ -25,7 +28,7 @@ public function manifest(): array
2528 foreach ($ this ->element ->manifest ->item as $ node ) {
2629 $ this ->manifest [] = new Item (
2730 (string ) $ node ->attributes ()['id ' ],
28- ( string ) $ node ->attributes ()['href ' ],
31+ dirname ( $ this -> file ) . ' / ' . $ node ->attributes ()['href ' ],
2932 (string ) $ node ->attributes ()['media-type ' ],
3033 );
3134 }
Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ public function container(): Container
2424 }
2525
2626 return $ this ->container = new Container (
27- SimpleXMLElement:: fromPath ( $ this ->extractionPath . '/META-INF/container.xml ' )
27+ $ this ->extractionPath . '/META-INF/container.xml ' ,
2828 );
2929 }
3030
@@ -35,7 +35,7 @@ public function content(): Content
3535 }
3636
3737 return $ this ->content = new Content (
38- SimpleXMLElement:: fromPath ( $ this ->extractionPath . ' / ' . $ this -> container ()->rootFile ()->path () )
38+ $ this ->container ()->rootFile ()->path ()
3939 );
4040 }
4141
You can’t perform that action at this time.
0 commit comments