| 1 | <?php namespace Arcanedev\GeoIP\Tasks; |
||
| 12 | class DownloadMaxmindDatabaseTask |
||
| 13 | { |
||
| 14 | /* ------------------------------------------------------------------------------------------------ |
||
| 15 | | Main Functions |
||
| 16 | | ------------------------------------------------------------------------------------------------ |
||
| 17 | */ |
||
| 18 | /** |
||
| 19 | * Run the task. |
||
| 20 | * |
||
| 21 | * @param string $url The database URL. |
||
| 22 | * @param string $path Destination path to save the file |
||
| 23 | * |
||
| 24 | * @return bool |
||
| 25 | * |
||
| 26 | * @throws Exception |
||
| 27 | */ |
||
| 28 | public static function run($url, $path) |
||
| 43 | |||
| 44 | /** |
||
| 45 | * Check the destination path. |
||
| 46 | * |
||
| 47 | * @param string $path |
||
| 48 | * |
||
| 49 | * @return string |
||
| 50 | * |
||
| 51 | * @throws Exception |
||
| 52 | */ |
||
| 53 | private static function checkDestinationPath($path) |
||
| 60 | |||
| 61 | /** |
||
| 62 | * Check the url status. |
||
| 63 | * |
||
| 64 | * @param string $url |
||
| 65 | * |
||
| 66 | * @throws \Exception |
||
| 67 | */ |
||
| 68 | private static function checkUrl($url) |
||
| 76 | } |
||
| 77 |
Let’s assume you have a class which uses late-static binding:
}
The code above will run fine in your PHP runtime. However, if you now create a sub-class and call the
getSomeVariable()on that sub-class, you will receive a runtime error:In the case above, it makes sense to update
SomeClassto useselfinstead: