1 | <?php |
||
25 | class DecimalMinutes implements FormatterInterface |
||
26 | { |
||
27 | const UNITS_UTF8 = 'UTF-8'; |
||
28 | const UNITS_ASCII = 'ASCII'; |
||
29 | |||
30 | /** |
||
31 | * @var string Separator string between latitude and longitude |
||
32 | */ |
||
33 | protected $separator; |
||
34 | |||
35 | /** |
||
36 | * Use cardinal letters for N/S and W/E instead of minus sign |
||
37 | * |
||
38 | * @var bool |
||
39 | */ |
||
40 | protected $useCardinalLetters; |
||
41 | |||
42 | /** |
||
43 | * @var string |
||
44 | */ |
||
45 | protected $unitType; |
||
46 | |||
47 | /** |
||
48 | * @var int |
||
49 | */ |
||
50 | protected $digits = 3; |
||
51 | |||
52 | /** |
||
53 | * @var string |
||
54 | */ |
||
55 | protected $decimalPoint = '.'; |
||
56 | |||
57 | /** |
||
58 | * @var array |
||
59 | */ |
||
60 | protected $units = [ |
||
61 | 'UTF-8' => [ |
||
62 | 'deg' => '°', |
||
63 | 'min' => '′', |
||
64 | ], |
||
65 | 'ASCII' => [ |
||
66 | 'deg' => '°', |
||
67 | 'min' => '\'', |
||
68 | ], |
||
69 | ]; |
||
70 | |||
71 | /** |
||
72 | * @param string $separator |
||
73 | */ |
||
74 | public function __construct($separator = " ") |
||
80 | |||
81 | /** |
||
82 | * Sets the separator between latitude and longitude values |
||
83 | * |
||
84 | * @param $separator |
||
85 | * |
||
86 | * @return DecimalMinutes |
||
87 | */ |
||
88 | public function setSeparator($separator) |
||
94 | |||
95 | /** |
||
96 | * @param bool $value |
||
97 | * |
||
98 | * @return DecimalMinutes |
||
99 | */ |
||
100 | public function useCardinalLetters($value) |
||
106 | |||
107 | /** |
||
108 | * @param string $type |
||
109 | * |
||
110 | * @throws \InvalidArgumentException |
||
111 | */ |
||
112 | public function setUnits($type) |
||
120 | |||
121 | /** |
||
122 | * @param int $digits |
||
123 | * |
||
124 | * @return DecimalMinutes |
||
125 | */ |
||
126 | public function setDigits($digits) |
||
132 | |||
133 | /** |
||
134 | * @param string $decimalPoint |
||
135 | * |
||
136 | * @return DecimalMinutes |
||
137 | */ |
||
138 | public function setDecimalPoint($decimalPoint) |
||
144 | |||
145 | /** |
||
146 | * @param Coordinate $coordinate |
||
147 | * |
||
148 | * @return string |
||
149 | */ |
||
150 | public function format(Coordinate $coordinate) |
||
184 | |||
185 | /** |
||
186 | * @param $lat |
||
187 | * |
||
188 | * @return string |
||
189 | */ |
||
190 | protected function getLatPrefix($lat) |
||
198 | |||
199 | /** |
||
200 | * @param $lng |
||
201 | * |
||
202 | * @return string |
||
203 | */ |
||
204 | protected function getLngPrefix($lng) |
||
212 | |||
213 | /** |
||
214 | * @param $lat |
||
215 | * |
||
216 | * @return string |
||
217 | */ |
||
218 | protected function getLatSuffix($lat) |
||
230 | |||
231 | /** |
||
232 | * @param $lng |
||
233 | * |
||
234 | * @return string |
||
235 | */ |
||
236 | protected function getLngSuffix($lng) |
||
248 | } |
||
249 |