|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* Copyright (c) 2019 - present |
|
4
|
|
|
* Google Maps PHP - PlacesResultt.php |
|
5
|
|
|
* author: Roberto Belotti - [email protected] |
|
6
|
|
|
* web : robertobelotti.com, github.com/biscolab |
|
7
|
|
|
* Initial version created on: 1/8/2019 |
|
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\Geometry; |
|
16
|
|
|
use Biscolab\GoogleMaps\Object\PhotoCollection; |
|
17
|
|
|
use Biscolab\GoogleMaps\Object\ReviewCollection; |
|
18
|
|
|
|
|
19
|
|
|
/** |
|
20
|
|
|
* Class PlacesResult |
|
21
|
|
|
* |
|
22
|
|
|
* @method PhotoCollection getPhotos() |
|
23
|
|
|
* @method Geometry getGeometry() |
|
24
|
|
|
* @method string getFormattedAddress() |
|
25
|
|
|
* @method string getName() |
|
26
|
|
|
* @method string getIcon() |
|
27
|
|
|
* @method string getId() |
|
28
|
|
|
* @method string getPlaceId() |
|
29
|
|
|
* @method string getReference() |
|
30
|
|
|
* @method string getVicinity() |
|
31
|
|
|
* @method array getTypes() |
|
32
|
|
|
* @method array getOpeningHours() |
|
33
|
|
|
* @method int getPriceLevel() |
|
34
|
|
|
* @method float getRating() |
|
35
|
|
|
* @method array getPlusCode() |
|
36
|
|
|
* @since 0.5.0 |
|
37
|
|
|
*/ |
|
38
|
|
|
class PlacesResult extends GoogleMapsResult |
|
39
|
|
|
{ |
|
40
|
|
|
|
|
41
|
|
|
/** |
|
42
|
|
|
* @var null|string |
|
43
|
|
|
*/ |
|
44
|
|
|
protected $formatted_address = null; |
|
45
|
|
|
|
|
46
|
|
|
/** |
|
47
|
|
|
* @var string |
|
48
|
|
|
*/ |
|
49
|
|
|
protected $name = ''; |
|
50
|
|
|
|
|
51
|
|
|
/** |
|
52
|
|
|
* @var Geometry |
|
53
|
|
|
*/ |
|
54
|
|
|
protected $geometry = null; |
|
55
|
|
|
|
|
56
|
|
|
/** |
|
57
|
|
|
* @var string |
|
58
|
|
|
*/ |
|
59
|
|
|
protected $icon = ''; |
|
60
|
|
|
|
|
61
|
|
|
/** |
|
62
|
|
|
* @var string |
|
63
|
|
|
*/ |
|
64
|
|
|
protected $id = ''; |
|
65
|
|
|
|
|
66
|
|
|
/** |
|
67
|
|
|
* @var PhotoCollection |
|
68
|
|
|
*/ |
|
69
|
|
|
protected $photos = null; |
|
70
|
|
|
|
|
71
|
|
|
/** |
|
72
|
|
|
* @var string |
|
73
|
|
|
*/ |
|
74
|
|
|
protected $place_id = ''; |
|
75
|
|
|
|
|
76
|
|
|
/** |
|
77
|
|
|
* @var string |
|
78
|
|
|
*/ |
|
79
|
|
|
protected $reference = ''; |
|
80
|
|
|
|
|
81
|
|
|
/** |
|
82
|
|
|
* @var string |
|
83
|
|
|
*/ |
|
84
|
|
|
protected $vicinity = ''; |
|
85
|
|
|
|
|
86
|
|
|
/** |
|
87
|
|
|
* @var array |
|
88
|
|
|
*/ |
|
89
|
|
|
protected $types = []; |
|
90
|
|
|
|
|
91
|
|
|
/** |
|
92
|
|
|
* @var array |
|
93
|
|
|
*/ |
|
94
|
|
|
protected $opening_hours = []; |
|
95
|
|
|
|
|
96
|
|
|
/** |
|
97
|
|
|
* @var int |
|
98
|
|
|
*/ |
|
99
|
|
|
protected $price_level = 0; |
|
100
|
|
|
|
|
101
|
|
|
/** |
|
102
|
|
|
* @var bool |
|
103
|
|
|
*/ |
|
104
|
|
|
protected $permanently_closed = false; |
|
105
|
|
|
|
|
106
|
|
|
/** |
|
107
|
|
|
* @var ReviewCollection |
|
108
|
|
|
*/ |
|
109
|
|
|
protected $reviews = null; |
|
110
|
|
|
|
|
111
|
|
|
/** |
|
112
|
|
|
* @var int |
|
113
|
|
|
*/ |
|
114
|
|
|
protected $utc_offset = 0; |
|
115
|
|
|
|
|
116
|
|
|
/** |
|
117
|
|
|
* @var string |
|
118
|
|
|
*/ |
|
119
|
|
|
protected $website = ''; |
|
120
|
|
|
|
|
121
|
|
|
/** |
|
122
|
|
|
* @var string |
|
123
|
|
|
*/ |
|
124
|
|
|
protected $international_phone_number = ''; |
|
125
|
|
|
|
|
126
|
|
|
/** |
|
127
|
|
|
* @var string |
|
128
|
|
|
*/ |
|
129
|
|
|
protected $formatted_phone_number = ''; |
|
130
|
|
|
|
|
131
|
|
|
/** |
|
132
|
|
|
* @var string |
|
133
|
|
|
*/ |
|
134
|
|
|
protected $adr_address = ''; |
|
135
|
|
|
|
|
136
|
|
|
/** |
|
137
|
|
|
* @var array |
|
138
|
|
|
*/ |
|
139
|
|
|
protected $typeCheck = [ |
|
140
|
|
|
GoogleMapsResultFields::FORMATTED_ADDRESS => 'string', |
|
141
|
|
|
GoogleMapsResultFields::NAME => 'string', |
|
142
|
|
|
GoogleMapsResultFields::GEOMETRY => Geometry::class, |
|
143
|
|
|
GoogleMapsResultFields::ICON => 'string', |
|
144
|
|
|
GoogleMapsResultFields::ID => 'string', |
|
145
|
|
|
GoogleMapsResultFields::PHOTOS => PhotoCollection::class, |
|
146
|
|
|
GoogleMapsResultFields::PLACE_ID => 'string', |
|
147
|
|
|
GoogleMapsResultFields::REFERENCE => 'string', |
|
148
|
|
|
GoogleMapsResultFields::VICINITY => 'string', |
|
149
|
|
|
GoogleMapsResultFields::TYPES => 'array', |
|
150
|
|
|
GoogleMapsResultFields::OPENING_HOURS => 'json', |
|
151
|
|
|
GoogleMapsResultFields::PRICE_LEVEL => 'int', |
|
152
|
|
|
GoogleMapsResultFields::RATING => 'float', |
|
153
|
|
|
GoogleMapsResultFields::PERMANENTLY_CLOSED => 'bool', |
|
154
|
|
|
GoogleMapsResultFields::PLUS_CODE => 'array', |
|
155
|
|
|
GoogleMapsResultFields::REVIEWS => ReviewCollection::class, |
|
156
|
|
|
GoogleMapsResultFields::UTC_OFFSET => 'int', |
|
157
|
|
|
GoogleMapsResultFields::WEBSITE => 'string', |
|
158
|
|
|
GoogleMapsResultFields::INTERNATIONAL_PHONE_NUMBER => 'string', |
|
159
|
|
|
GoogleMapsResultFields::FORMATTED_PHONE_NUMBER => 'string', |
|
160
|
|
|
GoogleMapsResultFields::ADR_ADDRESS => 'string', |
|
161
|
|
|
]; |
|
162
|
|
|
|
|
163
|
|
|
/** |
|
164
|
|
|
* @return bool|null |
|
165
|
|
|
*/ |
|
166
|
|
|
public function getPermanentlyClose(): bool |
|
167
|
|
|
{ |
|
168
|
|
|
|
|
169
|
|
|
return $this->permanently_closed ?? false; |
|
170
|
|
|
} |
|
171
|
|
|
|
|
172
|
|
|
} |