original_string: public static function unZip($zip_file, $destination)
      {
          $zip = new \ZipArchive();
          $archive = $zip->open($zip_file);
  
          if ($archive === true) {
              Folder::create($destination);
  
              $unzip = $zip->extractTo($destination);
  
  
              if (!$unzip) {
                  self::$error = self::ZIP_EXTRACT_ERROR;
                  Folder::delete($destination);
                  $zip->close();
                  return false;
              }
  
              $package_folder_name = preg_replace('#\./$#', '', $zip->getNameIndex(0));
              $zip->close();
  
              return $destination . '/' . $package_folder_name;
          }
  
          self::$error = self::ZIP_EXTRACT_ERROR;
          self::$error_zip = $archive;
          return false;
      }
code: public static function unZip($zip_file, $destination)
      {
          $zip = new \ZipArchive();
          $archive = $zip->open($zip_file);
  
          if ($archive === true) {
              Folder::create($destination);
  
              $unzip = $zip->extractTo($destination);
  
  
              if (!$unzip) {
                  self::$error = self::ZIP_EXTRACT_ERROR;
                  Folder::delete($destination);
                  $zip->close();
                  return false;
              }
  
              $package_folder_name = preg_replace('#\./$#', '', $zip->getNameIndex(0));
              $zip->close();
  
              return $destination . '/' . $package_folder_name;
          }
  
          self::$error = self::ZIP_EXTRACT_ERROR;
          self::$error_zip = $archive;
          return false;
      }
code_tokens: public static function unZip ( $ zip_file , $ destination ) { $ zip = new \ ZipArchive ( ) ; $ archive = $ zip -> open ( $ zip_file ) ; if ( $ archive === true ) { Folder :: create ( $ destination ) ; $ unzip = $ zip -> extractTo ( $ destination ) ; if ( ! $ unzip ) { self :: $ error = self :: ZIP_EXTRACT_ERROR ; Folder :: delete ( $ destination ) ; $ zip -> close ( ) ; return false ; } $ package_folder_name = preg_replace ( '#\./$#' , '' , $ zip -> getNameIndex ( 0 ) ) ; $ zip -> close ( ) ; return $ destination . '/' . $ package_folder_name ; } self :: $ error = self :: ZIP_EXTRACT_ERROR ; self :: $ error_zip = $ archive ; return false ; }
docstring: Unzip a file to somewhere
  
  @param string $zip_file
  @param string $destination
  @return bool|string
docstring_tokens: Unzip a file to somewhere