original_string: public function directory($source, $destination, $wrapper = '')
      {
          $files = gplcart_file_scan_recursive($source);
  
          if (empty($files)) {
              return false;
          }
  
          $this->set($destination, true);
  
          $added = 0;
          foreach ($files as $file) {
  
              if (is_dir($file)) {
                  $added++;
                  continue;
              }
  
              $prefix = $wrapper === '' ? '' : $wrapper . DIRECTORY_SEPARATOR;
              $relative = $prefix . substr($file, strlen($source) + 1);
              $added += (int) $this->zip->addFile($file, $relative);
          }
  
          $result = count($files) == $added;
          $this->zip->close();
          return $result;
      }
code: public function directory($source, $destination, $wrapper = '')
      {
          $files = gplcart_file_scan_recursive($source);
  
          if (empty($files)) {
              return false;
          }
  
          $this->set($destination, true);
  
          $added = 0;
          foreach ($files as $file) {
  
              if (is_dir($file)) {
                  $added++;
                  continue;
              }
  
              $prefix = $wrapper === '' ? '' : $wrapper . DIRECTORY_SEPARATOR;
              $relative = $prefix . substr($file, strlen($source) + 1);
              $added += (int) $this->zip->addFile($file, $relative);
          }
  
          $result = count($files) == $added;
          $this->zip->close();
          return $result;
      }
code_tokens: public function directory ( $ source , $ destination , $ wrapper = '' ) { $ files = gplcart_file_scan_recursive ( $ source ) ; if ( empty ( $ files ) ) { return false ; } $ this -> set ( $ destination , true ) ; $ added = 0 ; foreach ( $ files as $ file ) { if ( is_dir ( $ file ) ) { $ added ++ ; continue ; } $ prefix = $ wrapper === '' ? '' : $ wrapper . DIRECTORY_SEPARATOR ; $ relative = $ prefix . substr ( $ file , strlen ( $ source ) + 1 ) ; $ added += ( int ) $ this -> zip -> addFile ( $ file , $ relative ) ; } $ result = count ( $ files ) == $ added ; $ this -> zip -> close ( ) ; return $ result ; }
docstring: Zip a whole folder
  @param string $source
  @param string $destination
  @param string $wrapper Wrapping local directory in the archive
  @return boolean
docstring_tokens: Zip a whole folder