| @@ 265-279 (lines=15) @@ | ||
| 262 | * @throws \BrowscapPHP\Helper\Exception |
|
| 263 | * @return string the content of the loaded ini file |
|
| 264 | */ |
|
| 265 | public function load() |
|
| 266 | { |
|
| 267 | $internalLoader = $this->getLoader(); |
|
| 268 | $internalLoader |
|
| 269 | ->setRemoteDataUrl($this->getRemoteIniUrl()) |
|
| 270 | ->setTimeout($this->getTimeout()) |
|
| 271 | ; |
|
| 272 | ||
| 273 | try { |
|
| 274 | // Get updated .ini file |
|
| 275 | return $internalLoader->load(); |
|
| 276 | } catch (LoaderException $exception) { |
|
| 277 | throw new Exception('could not load the data file', 0, $exception); |
|
| 278 | } |
|
| 279 | } |
|
| 280 | ||
| 281 | /** |
|
| 282 | * Gets the remote file update timestamp |
|
| @@ 318-332 (lines=15) @@ | ||
| 315 | * @throws \BrowscapPHP\Helper\Exception |
|
| 316 | * @return integer the remote modification timestamp |
|
| 317 | */ |
|
| 318 | public function getRemoteVersion() |
|
| 319 | { |
|
| 320 | $internalLoader = $this->getLoader(); |
|
| 321 | $internalLoader |
|
| 322 | ->setRemoteVerUrl($this->getRemoteVersionUrl()) |
|
| 323 | ->setTimeout($this->getTimeout()) |
|
| 324 | ; |
|
| 325 | ||
| 326 | try { |
|
| 327 | // Get updated timestamp |
|
| 328 | return (int) $internalLoader->getMTime(); |
|
| 329 | } catch (LoaderException $exception) { |
|
| 330 | throw new Exception('could not load the new version', 0, $exception); |
|
| 331 | } |
|
| 332 | } |
|
| 333 | } |
|
| 334 | ||