| Conditions | 5 |
| Paths | 3 |
| Total Lines | 15 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 30 | public function geocode( $address ) { |
||
| 31 | $response = $this->fileFetcher->fetchFile( $this->getRequestUrl( $address ) ); |
||
| 32 | |||
| 33 | $jsonResponse = json_decode( $response ); |
||
| 34 | |||
| 35 | if ( !is_array( $jsonResponse ) || count( $jsonResponse ) < 1 ) { |
||
| 36 | return null; |
||
| 37 | } |
||
| 38 | |||
| 39 | $location = $jsonResponse[0]; |
||
| 40 | |||
| 41 | if ( !$location->lat || !$location->lon ) return null; |
||
| 42 | |||
| 43 | return new LatLongValue( $location->lat, $location->lon ); |
||
| 44 | } |
||
| 45 | |||
| 56 |