original_string: 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));
  		}
  	}
code: 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));
  		}
  	}
code_tokens: 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 ) ) ; } }
docstring: Copy file into zip
  
  @param \ZipArchive $epub
  @param string $src
  @param string $dir
  
  @throws CompileException
docstring_tokens: Copy file into zip