1 | <?php |
||
11 | class Coordinates |
||
12 | { |
||
13 | /** @var float $lat */ |
||
14 | protected $lat; |
||
15 | |||
16 | /** @var float $lon */ |
||
17 | protected $lon; |
||
18 | |||
19 | /** @var float $distance */ |
||
20 | protected $distance = 0.0; |
||
21 | |||
22 | /** |
||
23 | * @param float $lat Latitude |
||
24 | * @param float $lon Longitude |
||
25 | * @param int $distance Defaults to 20 km |
||
26 | */ |
||
27 | public function __construct($lat, $lon, $distance = 20) |
||
37 | |||
38 | /** |
||
39 | * @return float |
||
40 | */ |
||
41 | public function getLatitude() |
||
45 | |||
46 | /** |
||
47 | * @return float |
||
48 | */ |
||
49 | public function getLongitude() |
||
53 | |||
54 | /** |
||
55 | * @param Coordinates $coordinates |
||
56 | * @return Distance |
||
57 | */ |
||
58 | public function compareWith(Coordinates $coordinates) |
||
68 | |||
69 | /** |
||
70 | * @return BoundingBox |
||
71 | */ |
||
72 | public function getBoundingSquare() |
||
80 | |||
81 | /** |
||
82 | * @return float|int |
||
83 | */ |
||
84 | public function getMaxAcceptedDistance() |
||
88 | |||
89 | /** |
||
90 | * @return float|int |
||
91 | */ |
||
92 | public function getDistanceInMeters() |
||
96 | |||
97 | /** |
||
98 | * @return float|int |
||
99 | */ |
||
100 | public function getLongtitudeUnit() |
||
104 | |||
105 | /** |
||
106 | * @return float|int |
||
107 | */ |
||
108 | public function getLatitudeInMeters() |
||
112 | |||
113 | /** |
||
114 | * @param float $distance |
||
115 | */ |
||
116 | public function setMaxAcceptedDistance(float $distance) |
||
120 | } |
||
121 |
This check looks for assignments to scalar types that may be of the wrong type.
To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.