| Total Complexity | 5 |
| Total Lines | 24 |
| Duplicated Lines | 0 % |
| Coverage | 90% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 14 | abstract class Geographic extends CoordinateReferenceSystem |
||
| 15 | { |
||
| 16 | private static $supportedCache = []; |
||
| 17 | |||
| 18 | 5 | public static function fromSRID(string $srid) |
|
| 19 | { |
||
| 20 | 5 | if (isset(Geographic2D::getSupportedSRIDs()[$srid])) { |
|
| 21 | 3 | return Geographic2D::fromSRID($srid); |
|
| 22 | } |
||
| 23 | |||
| 24 | 2 | if (isset(Geographic3D::getSupportedSRIDs()[$srid])) { |
|
| 25 | 1 | return Geographic3D::fromSRID($srid); |
|
| 26 | } |
||
| 27 | |||
| 28 | 1 | throw new UnknownCoordinateReferenceSystemException($srid); |
|
| 29 | } |
||
| 30 | |||
| 31 | 1 | public static function getSupportedSRIDs(): array |
|
| 38 | } |
||
| 39 | } |
||
| 40 |
This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.
Consider making the comparison explicit by using
empty(..)or! empty(...)instead.