1 | <?php |
||
24 | class GlobeCoordinateParser implements ValueParser { |
||
25 | |||
26 | const FORMAT_NAME = 'globe-coordinate'; |
||
27 | |||
28 | /** |
||
29 | * Option specifying the globe. Should be a string containing a Wikidata concept URI. Defaults |
||
30 | * to Earth. |
||
31 | */ |
||
32 | const OPT_GLOBE = 'globe'; |
||
33 | |||
34 | private $options; |
||
35 | |||
36 | 119 | public function __construct( ParserOptions $options = null ) { |
|
42 | |||
43 | 2 | public function setOptions( ParserOptions $options ) { |
|
47 | |||
48 | /** |
||
49 | * @see StringValueParser::stringParse |
||
50 | * |
||
51 | * @param string $value |
||
52 | * |
||
53 | * @throws ParseException |
||
54 | * @return GlobeCoordinateValue |
||
55 | */ |
||
56 | 119 | public function parse( $value ) { |
|
80 | |||
81 | /** |
||
82 | * @param LatLongValue $latLong |
||
83 | * @param string $precisionDetector |
||
84 | * |
||
85 | * @return float|int |
||
86 | */ |
||
87 | 117 | private function detectPrecision( LatLongValue $latLong, $precisionDetector ) { |
|
97 | |||
98 | /** |
||
99 | * @return ValueParser[] |
||
100 | */ |
||
101 | 119 | private function getParsers() { |
|
111 | |||
112 | /** |
||
113 | * @param float $degree |
||
114 | * |
||
115 | * @return float|int |
||
116 | */ |
||
117 | 29 | protected function detectDdPrecision( $degree ) { |
|
120 | |||
121 | /** |
||
122 | * @param float $degree |
||
123 | * |
||
124 | * @return float|int |
||
125 | */ |
||
126 | 25 | protected function detectDmPrecision( $degree ) { |
|
136 | |||
137 | /** |
||
138 | * @param float $degree |
||
139 | * |
||
140 | * @return float|int |
||
141 | */ |
||
142 | 42 | protected function detectDmsPrecision( $degree ) { |
|
152 | |||
153 | /** |
||
154 | * @param float $degree |
||
155 | * |
||
156 | * @return float|int |
||
157 | */ |
||
158 | 62 | protected function detectFloatPrecision( $degree ) { |
|
167 | |||
168 | } |
||
169 |