Add zipClass parameter in the constructor, to be able to replace the default clsTbsZip class

This commit is contained in:
Didier Corbière 2013-09-11 00:46:19 +01:00
parent 8e16d68f26
commit fd774948fb

View file

@ -26,12 +26,13 @@ class EPub {
* Constructor * Constructor
* *
* @param string $file path to epub file to work on * @param string $file path to epub file to work on
* @param string $zipClass class to handle zip
* @throws Exception if metadata could not be loaded * @throws Exception if metadata could not be loaded
*/ */
public function __construct($file){ public function __construct($file, $zipClass = 'clsTbsZip'){
// open file // open file
$this->file = $file; $this->file = $file;
$this->zip = new clsTbsZip(); $this->zip = new $zipClass();
if(!$this->zip->Open($this->file)){ if(!$this->zip->Open($this->file)){
throw new Exception('Failed to read epub file'); throw new Exception('Failed to read epub file');
} }