| Conditions | 4 |
| Paths | 3 |
| Total Lines | 17 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php |
||
| 30 | 4 | public function geocode( $address ) { |
|
| 31 | try { |
||
| 32 | 4 | $response = $this->fileFetcher->fetchFile( $this->getRequestUrl( $address ) ); |
|
| 33 | } |
||
| 34 | 1 | catch ( FileFetchingException $ex ) { |
|
| 35 | 1 | return null; |
|
| 36 | } |
||
| 37 | |||
| 38 | 3 | $lon = self::getXmlElementValue( $response, 'lng' ); |
|
| 39 | 3 | $lat = self::getXmlElementValue( $response, 'lat' ); |
|
| 40 | |||
| 41 | 3 | if ( !$lon || !$lat ) { |
|
| 42 | 2 | return null; |
|
| 43 | } |
||
| 44 | |||
| 45 | 1 | return new LatLongValue( (float)$lat, (float)$lon ); |
|
| 46 | } |
||
| 47 | |||
| 67 |
In PHP, under loose comparison (like
==, or!=, orswitchconditions), values of different types might be equal.For
stringvalues, the empty string''is a special case, in particular the following results might be unexpected: