| Conditions | 1 |
| Paths | 1 |
| Total Lines | 14 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 2 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php namespace Arcanedev\GeoIP\Tasks; |
||
| 29 | public static function run($url, $path) |
||
| 30 | { |
||
| 31 | $path = static::checkDestinationPath($path); |
||
|
|
|||
| 32 | |||
| 33 | static::checkUrl($url); |
||
| 34 | |||
| 35 | $tmpFile = tempnam(sys_get_temp_dir(), 'maxmind'); |
||
| 36 | file_put_contents($tmpFile, fopen($url, 'r')); |
||
| 37 | file_put_contents($path, gzopen($tmpFile, 'r')); |
||
| 38 | |||
| 39 | unlink($tmpFile); |
||
| 40 | |||
| 41 | return true; |
||
| 42 | } |
||
| 43 | |||
| 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: