Skip to content

Instantly share code, notes, and snippets.

@mcsee
Last active August 20, 2023 20:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mcsee/4753e242da21027d2a8e7243de877250 to your computer and use it in GitHub Desktop.
Save mcsee/4753e242da21027d2a8e7243de877250 to your computer and use it in GitHub Desktop.
<?
final class GeographicCoordinate {
function __construct($latitudeInDegrees, $longitudeInDegrees) {
if (!$this->isValidLatitude($latitudeInDegrees)) {
throw new InvalidLatitudeException($latitudeInDegrees);
// ...
$this->longitude = $longitudeInDegrees;
$this->latitude = $latitudeInDegrees;
}
}
}
$coordinate = new GeographicCoordinate(1000, 2000);
// throws an error since these values don't exist on Earth
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment