You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

30 lines
670 B

<?php
namespace OSM;
class Point {
public float $latitude;
public float $longitude;
public static function createFromArray(array $array)
{
$hasLat = isset($array['lat']);
$hasLon = isset($array['lon']);
assert($hasLat and $hasLon);
$instance = new self();
$instance->latitude = (float) $array['lat'];
$instance->longitude = (float) $array['lon'];
return $instance;
}
public function isSame(Point $other): bool {
$isSame = (
($other->latitude === $this->latitude)
and ($other->longitude === $this->longitude)
);
return $isSame;
}
}