GeocodingResult::getAddress()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 1
c 2
b 0
f 0
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 0
crap 1
1
<?php
2
/**
3
 * Copyright (c) 2018 - present
4
 * Google Maps PHP - GeocodingResult.php
5
 * author: Roberto Belotti - [email protected]
6
 * web : robertobelotti.com, github.com/biscolab
7
 * Initial version created on: 5/9/2018
8
 * MIT license: https://github.com/biscolab/google-maps-php/blob/master/LICENSE
9
 */
10
11
namespace Biscolab\GoogleMaps\Http\Result;
12
13
use Biscolab\GoogleMaps\Fields\GoogleMapsResultFields;
14
use Biscolab\GoogleMaps\Http\GoogleMapsResult;
15
use Biscolab\GoogleMaps\Object\Address;
16
use Biscolab\GoogleMaps\Object\Geometry;
17
18
/**
19
 * Class GeocodingResult
20
 *
21
 * Standard and Reverse Geocoding have the same Response/Result format
22
 *
23
 * @method Address getAddressComponents()
24
 * @method string getFormattedAddress()
25
 * @method Geometry getGeometry()
26
 * @method string getPlaceId()
27
 * @method array getTypes()
28
 * @method GeocodingResult setAddressComponents($args)
29
 * @method GeocodingResult setFormattedAddress($args)
30
 * @method GeocodingResult setGeometry($args)
31
 * @method GeocodingResult setPlaceId($args)
32
 * @method GeocodingResult setTypes($args)
33
 * @package Biscolab\GoogleMaps\Http\Result
34
 */
35
class GeocodingResult extends GoogleMapsResult
36
{
37
38
	/**
39
	 * @var Address
40
	 */
41
	protected $address_components = null;
42
43
	/**
44
	 * @var string
45
	 */
46
	protected $formatted_address = null;
47
48
	/**
49
	 * @var Geometry
50
	 */
51
	protected $geometry = null;
52
53
	/**
54
	 * @var string
55
	 */
56
	protected $place_id = null;
57
58
	/**
59
	 * @var array
60
	 */
61
	protected $types = null;
62
63
	/**
64
	 * @var array
65
	 */
66
	protected $typeCheck = [
67
		GoogleMapsResultFields::GEOMETRY           => Geometry::class,
68
		GoogleMapsResultFields::ADDRESS_COMPONENTS => Address::class,
69
		GoogleMapsResultFields::FORMATTED_ADDRESS  => 'string',
70
		GoogleMapsResultFields::PLACE_ID           => 'string',
71
		GoogleMapsResultFields::TYPES              => 'array'
72
	];
73
74
	/**
75
	 * @return Address
76
	 */
77 1
	public function getAddress(): Address
78
	{
79
80 1
		return $this->getAddressComponents();
81
	}
82
83
}