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
|
|
|
* @var Address |
39
|
|
|
*/ |
40
|
|
|
protected $address_components = null; |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* @var string |
44
|
|
|
*/ |
45
|
|
|
protected $formatted_address = null; |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* @var Geometry |
49
|
|
|
*/ |
50
|
|
|
protected $geometry = null; |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* @var string |
54
|
|
|
*/ |
55
|
|
|
protected $place_id = null; |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* @var array |
59
|
|
|
*/ |
60
|
|
|
protected $types = null; |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* @var array |
64
|
|
|
*/ |
65
|
|
|
protected $typeCheck = [ |
66
|
|
|
GoogleMapsResultFields::GEOMETRY => Geometry::class, |
67
|
|
|
GoogleMapsResultFields::ADDRESS_COMPONENTS => Address::class, |
68
|
|
|
GoogleMapsResultFields::FORMATTED_ADDRESS => 'string', |
69
|
|
|
GoogleMapsResultFields::PLACE_ID => 'string', |
70
|
|
|
GoogleMapsResultFields::TYPES => 'array' |
71
|
|
|
]; |
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* @return Address |
75
|
|
|
*/ |
76
|
|
|
public function getAddress(): Address { |
77
|
|
|
|
78
|
|
|
return $this->getAddressComponents(); |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
} |