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
1 changed files with 3 additions and 2 deletions

View File

@ -26,12 +26,13 @@ class EPub {
* Constructor
*
* @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
*/
public function __construct($file){
public function __construct($file, $zipClass = 'clsTbsZip'){
// open file
$this->file = $file;
$this->zip = new clsTbsZip();
$this->zip = new $zipClass();
if(!$this->zip->Open($this->file)){
throw new Exception('Failed to read epub file');
}