|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* Copyright (c) 2019 - present |
|
4
|
|
|
* Google Maps PHP - TimeZone.php |
|
5
|
|
|
* author: Roberto Belotti - [email protected] |
|
6
|
|
|
* web : robertobelotti.com, github.com/biscolab |
|
7
|
|
|
* Initial version created on: 8/10/2019 |
|
8
|
|
|
* MIT license: https://github.com/biscolab/google-maps-php/blob/master/LICENSE |
|
9
|
|
|
*/ |
|
10
|
|
|
|
|
11
|
|
|
namespace Biscolab\GoogleMaps\Api; |
|
12
|
|
|
|
|
13
|
|
|
use Biscolab\GoogleMaps\Abstracts\Api; |
|
14
|
|
|
use Biscolab\GoogleMaps\Fields\GoogleMapsRequestFields; |
|
15
|
|
|
use Biscolab\GoogleMaps\Http\GoogleMapsResult; |
|
16
|
|
|
use Biscolab\GoogleMaps\Http\Result\ElevationResultsCollection; |
|
17
|
|
|
use Biscolab\GoogleMaps\Http\Result\TimeZoneResult; |
|
18
|
|
|
use Biscolab\GoogleMaps\Object\Location; |
|
19
|
|
|
|
|
20
|
|
|
/** |
|
21
|
|
|
* Class TimeZone |
|
22
|
|
|
* @package Biscolab\GoogleMaps\Api |
|
23
|
|
|
* |
|
24
|
|
|
* @since 0.7.0 |
|
25
|
|
|
* @see https://developers.google.com/maps/documentation/timezone/intro |
|
26
|
|
|
*/ |
|
27
|
|
|
class TimeZone extends Api |
|
28
|
|
|
{ |
|
29
|
|
|
|
|
30
|
|
|
/** |
|
31
|
|
|
* @var string |
|
32
|
|
|
*/ |
|
33
|
|
|
const SERVICE_ENDPOINT = 'timezone'; |
|
34
|
|
|
|
|
35
|
|
|
/** |
|
36
|
|
|
* @var string |
|
37
|
|
|
*/ |
|
38
|
|
|
protected $result_type = TimeZoneResult::class; |
|
39
|
|
|
|
|
40
|
|
|
/** |
|
41
|
|
|
* @param Location $location |
|
42
|
|
|
* @param int $timestamp |
|
43
|
|
|
* @param string|null $language |
|
44
|
|
|
* |
|
45
|
|
|
* @return GoogleMapsResult |
|
46
|
|
|
*/ |
|
47
|
|
|
public function get(Location $location, int $timestamp, string $language = null): GoogleMapsResult |
|
48
|
|
|
{ |
|
49
|
|
|
|
|
50
|
|
|
$params = [ |
|
51
|
|
|
GoogleMapsRequestFields::LOCATION => $location, |
|
52
|
|
|
GoogleMapsRequestFields::TIMESTAMP => $timestamp, |
|
53
|
|
|
]; |
|
54
|
|
|
|
|
55
|
|
|
if ($language) { |
|
56
|
|
|
$params[GoogleMapsRequestFields::LANGUAGE] = $language; |
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
|
|
return $this->callApi($params); |
|
|
|
|
|
|
60
|
|
|
} |
|
61
|
|
|
} |