private function deliver( \ZipArchive &$epub, $src, $dir = ''){
		if( !$dir ){
			$dir = $src;
		}
		if( is_dir($src) ){
			$root = rtrim($src, DIRECTORY_SEPARATOR);
			foreach( scandir($src) as $file ){
				if( !preg_match('/^\./', $file) ){
					// Skip dot files
					$path = $root.DIRECTORY_SEPARATOR.$file;
					$this->deliver($epub, $path, $dir);
				}
			}
		}elseif( file_exists($src) ){
			$relative_path = ltrim(str_replace($dir, '', $src), DIRECTORY_SEPARATOR);
			$epub->addFile($src, $relative_path);
		}else{
			throw new CompileException(sprintf('Cannot copy file %s.', $src));
		}
	}
private function deliver( \ZipArchive &$epub, $src, $dir = ''){
		if( !$dir ){
			$dir = $src;
		}
		if( is_dir($src) ){
			$root = rtrim($src, DIRECTORY_SEPARATOR);
			foreach( scandir($src) as $file ){
				if( !preg_match('/^\./', $file) ){
					// Skip dot files
					$path = $root.DIRECTORY_SEPARATOR.$file;
					$this->deliver($epub, $path, $dir);
				}
			}
		}elseif( file_exists($src) ){
			$relative_path = ltrim(str_replace($dir, '', $src), DIRECTORY_SEPARATOR);
			$epub->addFile($src, $relative_path);
		}else{
			throw new CompileException(sprintf('Cannot copy file %s.', $src));
		}
	}
private function deliver ( \ ZipArchive & $ epub , $ src , $ dir = '' ) { if ( ! $ dir ) { $ dir = $ src ; } if ( is_dir ( $ src ) ) { $ root = rtrim ( $ src , DIRECTORY_SEPARATOR ) ; foreach ( scandir ( $ src ) as $ file ) { if ( ! preg_match ( '/^\./' , $ file ) ) { // Skip dot files $ path = $ root . DIRECTORY_SEPARATOR . $ file ; $ this -> deliver ( $ epub , $ path , $ dir ) ; } } } elseif ( file_exists ( $ src ) ) { $ relative_path = ltrim ( str_replace ( $ dir , '' , $ src ) , DIRECTORY_SEPARATOR ) ; $ epub -> addFile ( $ src , $ relative_path ) ; } else { throw new CompileException ( sprintf ( 'Cannot copy file %s.' , $ src ) ) ; } }
Copy file into zip

@param \ZipArchive $epub
@param string $src
@param string $dir

@throws CompileException
Copy file into zip