1 | <?php |
||
17 | class JsonLdGlobeCoordinateFormatter extends ValueFormatterBase implements JsonLdDataValueFormatter { |
||
18 | |||
19 | /** |
||
20 | * @var GlobeCoordinateFormatter |
||
21 | */ |
||
22 | private $globeCoordinateFormatter; |
||
23 | |||
24 | /** |
||
25 | * @param GlobeCoordinateFormatter $globeCoordinateFormatter |
||
26 | * @param FormatterOptions|null $options |
||
27 | */ |
||
28 | 1 | public function __construct(GlobeCoordinateFormatter $globeCoordinateFormatter, FormatterOptions $options = null) { |
|
33 | |||
34 | /** |
||
35 | * @see ValueFormatter::format |
||
36 | */ |
||
37 | 1 | public function format($value) { |
|
38 | 1 | if(!($value instanceof GlobeCoordinateValue)) { |
|
39 | throw new InvalidArgumentException('$value is not a GlobeCoordinateValue.'); |
||
40 | } |
||
41 | |||
42 | 1 | return $this->toJsonLd($value); |
|
43 | } |
||
44 | |||
45 | 1 | private function toJsonLd(GlobeCoordinateValue $value) { |
|
53 | |||
54 | /** |
||
55 | * copy of GeoCoordinateFormatter::roundDegrees |
||
56 | */ |
||
57 | 1 | private function roundDegrees($degrees, $precision) { |
|
68 | } |
||
69 |