/** * Download the remote Phar file. * * @param Updater $updater Updater. * * @return void * @throws \LogicException When there is nothing to download. */ public function download(Updater $updater) { if (!$this->remoteUrl) { throw new \LogicException('Run "hasUpdate()" on updater prior to downloading new version.'); } file_put_contents($updater->getTempPharFile(), $this->downloadFile($this->remoteUrl)); }
/** * Download the remote Phar file. * * @param Updater $updater * @return void */ public function download(Updater $updater) { /** Switch remote request errors to HttpRequestExceptions */ set_error_handler(array($updater, 'throwHttpRequestException')); $result = humbug_get_contents($this->remoteUrl); restore_error_handler(); if (false === $result) { throw new HttpRequestException(sprintf('Request to URL failed: %s', $this->remoteUrl)); } file_put_contents($updater->getTempPharFile(), $result); }