Conditions | 2 |
Paths | 2 |
Total Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
32 | 76 | public function geocode( string $address ) { |
|
33 | 76 | $key = $this->cache->makeKey( __CLASS__, $address ); |
|
34 | |||
35 | 76 | $coordinates = $this->cache->get( $key ); |
|
36 | |||
37 | // There was no entry in the cache, so we retrieve the coordinates |
||
38 | 76 | if ( $coordinates === false ) { |
|
39 | 7 | $coordinates = $this->geocoder->geocode( $address ); |
|
40 | |||
41 | 7 | $this->cache->set( $key, $coordinates, $this->cacheTtl ); |
|
42 | } |
||
43 | |||
44 | 76 | return $coordinates; |
|
45 | } |
||
46 | } |
||
47 |