Completed
Push — mawiki ( ed8c52 )
by Jeroen De
08:10
created

MapsDecoratedGeocoder   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 32
rs 10
wmc 5
lcom 1
cbo 3

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A geocode() 0 12 2
A getRequestUrl() 0 1 1
A parseResponse() 0 1 1
1
<?php
2
3
use Maps\Geocoders\Geocoder;
4
5
/**
6
 * @since 3.8
7
 *
8
 * @licence GNU GPL v2+
9
 * @author Jeroen De Dauw < [email protected] >
10
 */
11
final class MapsDecoratedGeocoder extends \Maps\Geocoder {
12
13
	private $geocoder;
14
15
	/**
16
	 * @param Geocoder $geocoder
17
	 * @param string $identifier
18
	 */
19
	public function __construct( Geocoder $geocoder, $identifier ) {
20
		$this->geocoder = $geocoder;
21
22
		parent::__construct( $identifier );
23
	}
24
25
	public function geocode( $address ) {
26
		$result = $this->geocoder->geocode( $address );
27
28
		if ( $result === null ) {
29
			return false;
30
		}
31
32
		return [
33
			'lat' => $result->getLatitude(),
34
			'lon' => $result->getLongitude(),
35
		];
36
	}
37
38
	protected function getRequestUrl( $address ) {}
39
40
	protected function parseResponse( $response ) {}
41
42
}
43