1 | <?php |
||
21 | class Coordinate implements ValueObjectInterface |
||
22 | { |
||
23 | const EARTH_RADIUS = 6378136.0; //m |
||
24 | |||
25 | /** |
||
26 | * @var Latitude |
||
27 | */ |
||
28 | protected $latitude; |
||
29 | |||
30 | /** |
||
31 | * @var Longitude |
||
32 | */ |
||
33 | protected $longitude; |
||
34 | |||
35 | /** |
||
36 | * @param float $latitude |
||
37 | * @param float $longitude |
||
38 | * |
||
39 | * @return Coordinate |
||
40 | */ |
||
41 | public static function fromLatLng($latitude, $longitude) |
||
45 | |||
46 | /** |
||
47 | * @param Latitude $latitude |
||
48 | * @param Longitude $longitude |
||
49 | */ |
||
50 | public function __construct(Latitude $latitude, Longitude $longitude) |
||
55 | |||
56 | /** |
||
57 | * @return Latitude |
||
58 | */ |
||
59 | public function latitude() |
||
63 | |||
64 | /** |
||
65 | * @return Longitude |
||
66 | */ |
||
67 | public function longitude() |
||
71 | |||
72 | /** |
||
73 | * @param Coordinate $coordinate |
||
74 | * @param DistanceUnit $unit |
||
75 | */ |
||
76 | public function distance(Coordinate $coordinate, DistanceUnit $unit = null) |
||
87 | |||
88 | /** |
||
89 | * {@inheritdoc} |
||
90 | */ |
||
91 | public function equals($other) |
||
97 | |||
98 | /** |
||
99 | * {@inheritdoc} |
||
100 | */ |
||
101 | public function hashCode() |
||
105 | |||
106 | /** |
||
107 | * {@inheritdoc} |
||
108 | */ |
||
109 | public function __toString() |
||
113 | } |
||
114 |