@@ 67-80 (lines=14) @@ | ||
64 | * @param Updater $updater |
|
65 | * @return void |
|
66 | */ |
|
67 | public function download(Updater $updater) |
|
68 | { |
|
69 | /** Switch remote request errors to HttpRequestExceptions */ |
|
70 | set_error_handler(array($updater, 'throwHttpRequestException')); |
|
71 | $result = humbug_get_contents($this->remoteUrl); |
|
72 | restore_error_handler(); |
|
73 | if (false === $result) { |
|
74 | throw new HttpRequestException(sprintf( |
|
75 | 'Request to URL failed: %s', $this->remoteUrl |
|
76 | )); |
|
77 | } |
|
78 | ||
79 | file_put_contents($updater->getTempPharFile(), $result); |
|
80 | } |
|
81 | ||
82 | /** |
|
83 | * Retrieve the current version available remotely. |
@@ 45-58 (lines=14) @@ | ||
42 | * @param Updater $updater |
|
43 | * @return void |
|
44 | */ |
|
45 | public function download(Updater $updater) |
|
46 | { |
|
47 | /** Switch remote request errors to HttpRequestExceptions */ |
|
48 | set_error_handler(array($updater, 'throwHttpRequestException')); |
|
49 | $result = humbug_get_contents($this->getPharUrl()); |
|
50 | restore_error_handler(); |
|
51 | if (false === $result) { |
|
52 | throw new HttpRequestException(sprintf( |
|
53 | 'Request to URL failed: %s', $this->getPharUrl() |
|
54 | )); |
|
55 | } |
|
56 | ||
57 | file_put_contents($updater->getTempPharFile(), $result); |
|
58 | } |
|
59 | ||
60 | /** |
|
61 | * Set URL to phar file |