1 | <?php |
||
2 | |||
3 | /** |
||
4 | * Copyright (c) 2019 - present |
||
5 | * Google Maps PHP - TimeZone.php |
||
6 | * author: Roberto Belotti - [email protected] |
||
7 | * web : robertobelotti.com, github.com/biscolab |
||
8 | * Initial version created on: 8/10/2019 |
||
9 | * MIT license: https://github.com/biscolab/google-maps-php/blob/master/LICENSE |
||
10 | */ |
||
11 | |||
12 | namespace Biscolab\GoogleMaps\Api; |
||
13 | |||
14 | use Biscolab\GoogleMaps\Abstracts\Api; |
||
15 | use Biscolab\GoogleMaps\Fields\GoogleMapsRequestFields; |
||
16 | use Biscolab\GoogleMaps\Http\GoogleMapsResult; |
||
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); |
||
0 ignored issues
–
show
Bug
Best Practice
introduced
by
![]() |
|||
60 | } |
||
61 | } |
||
62 |