| Conditions | 3 |
| Paths | 3 |
| Total Lines | 11 |
| Code Lines | 5 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 6 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 18 | 45 | public static function fromSRID(string $srid): self |
|
| 19 | { |
||
| 20 | 45 | if (isset(Geographic2D::getSupportedSRIDs()[$srid])) { |
|
| 21 | 27 | return Geographic2D::fromSRID($srid); |
|
| 22 | } |
||
| 23 | |||
| 24 | 18 | if (isset(Geographic3D::getSupportedSRIDs()[$srid])) { |
|
| 25 | 9 | return Geographic3D::fromSRID($srid); |
|
| 26 | } |
||
| 27 | |||
| 28 | 9 | throw new UnknownCoordinateReferenceSystemException($srid); |
|
| 29 | } |
||
| 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.