1 | <?php |
||
20 | class GoogleMaps extends AbstractHttpProvider |
||
21 | { |
||
22 | const ENDPOINT = 'https://maps.googleapis.com/maps/api/timezone/json'; |
||
23 | |||
24 | /** |
||
25 | * @var array |
||
26 | */ |
||
27 | private $errorStatus = [ |
||
28 | 'INVALID_REQUEST', |
||
29 | 'OVER_QUERY_LIMIT', |
||
30 | 'REQUEST_DENIED', |
||
31 | 'UNKNOWN_ERROR', |
||
32 | 'ZERO_RESULTS', |
||
33 | ]; |
||
34 | |||
35 | /** |
||
36 | * @var string |
||
37 | */ |
||
38 | private $apiKey; |
||
39 | |||
40 | /** |
||
41 | * Google constructor. |
||
42 | * |
||
43 | * @param string $apiKey |
||
44 | * @param HttpClient $client |
||
45 | * @param MessageFactory $messageFactory |
||
46 | */ |
||
47 | public function __construct($apiKey = null, HttpClient $client = null, MessageFactory $messageFactory = null) |
||
53 | |||
54 | /** |
||
55 | * Returns the name of this provider. |
||
56 | * |
||
57 | * @return string |
||
58 | */ |
||
59 | public function getName() |
||
63 | |||
64 | /** |
||
65 | * Returns ZoneInfo for the specified location and timestamp. |
||
66 | * |
||
67 | * @param string|float $lat Coordinate latitude. |
||
68 | * @param string|float $lng Coordinate longitude. |
||
69 | * @param int $timestamp UNIX timestamp used to determine Daylight Savings Time. |
||
70 | * |
||
71 | * @throws RuntimeException |
||
72 | * |
||
73 | * @return ZoneInfo |
||
74 | */ |
||
75 | public function find($lat, $lng, $timestamp = null) |
||
89 | |||
90 | /** |
||
91 | * Returns the URI for the specified location and timestamp. |
||
92 | * |
||
93 | * @param string|float $lat Coordinate latitude. |
||
94 | * @param string|float $lng Coordinate longitude. |
||
95 | * @param int|null $timestamp Seconds since Jan 1, 1970 UTC. |
||
96 | * |
||
97 | * @return string |
||
98 | */ |
||
99 | protected function buildUri($lat, $lng, $timestamp = null) |
||
112 | } |
||
113 |