| Total Complexity | 5 |
| Total Lines | 26 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 10 | class Algorithm extends BaseAlgorithm |
||
| 11 | { |
||
| 12 | public function getDistanceBetween(PointInterface $pointA, PointInterface $pointB): float |
||
| 13 | { |
||
| 14 | if (! $pointA instanceof Point || ! $pointB instanceof Point) { |
||
| 15 | throw new \InvalidArgumentException( |
||
| 16 | "GPS algorithm can only calculate distance from GPS locations" |
||
| 17 | ); |
||
| 18 | } |
||
| 19 | |||
| 20 | return Math::haversine($pointA->getCoordinates(), $pointB->getCoordinates()); |
||
| 21 | } |
||
| 22 | |||
| 23 | public function findCentroid(PointCollectionInterface $points): PointInterface |
||
| 36 | )); |
||
| 37 | } |
||
| 39 |