original_string: public static function downloadPackage($package_file, $tmp)
      {
          $package = parse_url($package_file);
          $filename = basename($package['path']);
  
          if (Grav::instance()['config']->get('system.gpm.official_gpm_only') && $package['host'] !== 'getgrav.org') {
              throw new \RuntimeException("Only official GPM URLs are allowed. You can modify this behavior in the System configuration.");
          }
  
          $output = Response::get($package_file, []);
  
          if ($output) {
              Folder::create($tmp);
              file_put_contents($tmp . DS . $filename, $output);
              return $tmp . DS . $filename;
          }
  
          return null;
      }
code: public static function downloadPackage($package_file, $tmp)
      {
          $package = parse_url($package_file);
          $filename = basename($package['path']);
  
          if (Grav::instance()['config']->get('system.gpm.official_gpm_only') && $package['host'] !== 'getgrav.org') {
              throw new \RuntimeException("Only official GPM URLs are allowed. You can modify this behavior in the System configuration.");
          }
  
          $output = Response::get($package_file, []);
  
          if ($output) {
              Folder::create($tmp);
              file_put_contents($tmp . DS . $filename, $output);
              return $tmp . DS . $filename;
          }
  
          return null;
      }
code_tokens: public static function downloadPackage ( $ package_file , $ tmp ) { $ package = parse_url ( $ package_file ) ; $ filename = basename ( $ package [ 'path' ] ) ; if ( Grav :: instance ( ) [ 'config' ] -> get ( 'system.gpm.official_gpm_only' ) && $ package [ 'host' ] !== 'getgrav.org' ) { throw new \ RuntimeException ( "Only official GPM URLs are allowed. You can modify this behavior in the System configuration." ) ; } $ output = Response :: get ( $ package_file , [ ] ) ; if ( $ output ) { Folder :: create ( $ tmp ) ; file_put_contents ( $ tmp . DS . $ filename , $ output ) ; return $ tmp . DS . $ filename ; } return null ; }
docstring: Download the zip package via the URL
  
  @param string $package_file
  @param string $tmp
  @return null|string
docstring_tokens: Download the zip package via the URL