1 | <?php |
||
10 | class Calculator |
||
11 | { |
||
12 | protected $quadrantTree; |
||
13 | |||
14 | /** |
||
15 | * TimeZone constructor. |
||
16 | * @param $dataDirectory |
||
17 | * @throws ErrorException |
||
18 | */ |
||
19 | 25 | public function __construct($dataDirectory = null) |
|
28 | |||
29 | /** |
||
30 | * Adjust the latitude value |
||
31 | * @param $latitude |
||
32 | * @return float|int |
||
33 | * @throws ErrorException |
||
34 | */ |
||
35 | 23 | protected function adjustLatitude($latitude) |
|
46 | |||
47 | /** |
||
48 | * Adjust longitude value |
||
49 | * @param $longitude |
||
50 | * @return float|int |
||
51 | * @throws ErrorException |
||
52 | */ |
||
53 | 21 | protected function adjustLongitude($longitude) |
|
64 | |||
65 | /** |
||
66 | * Get timezone name from a particular location (latitude, longitude) |
||
67 | * @param $latitude |
||
68 | * @param $longitude |
||
69 | * @return string |
||
70 | * @throws ErrorException |
||
71 | */ |
||
72 | 21 | public function getTimeZoneName($latitude, $longitude) |
|
84 | |||
85 | /** |
||
86 | * Get the local date belonging to a particular latitude, longitude and timestamp |
||
87 | * @param $latitude |
||
88 | * @param $longitude |
||
89 | * @param $timestamp |
||
90 | * @return DateTime |
||
91 | * @throws ErrorException |
||
92 | */ |
||
93 | 7 | public function getLocalDate($latitude, $longitude, $timestamp) |
|
107 | |||
108 | /** |
||
109 | * Get timestamp from latitude, longitude and localTimestamp |
||
110 | * @param $latitude |
||
111 | * @param $longitude |
||
112 | * @param $localTimestamp |
||
113 | * @return mixed |
||
114 | * @throws ErrorException |
||
115 | */ |
||
116 | 3 | public function getCorrectTimestamp($latitude, $longitude, $localTimestamp) |
|
134 | } |
||
135 | |||
136 |