/** * Returns a new Coordinate object from native PHP arguments * * @return self * @throws \BadMethodCallException */ public static function fromNative() { $args = \func_get_args(); if (\count($args) < 2 || \count($args) > 3) { throw new \BadMethodCallException('You must provide 2 to 3 arguments: 1) latitude, 2) longitude, 3) valid ellipsoid type (optional)'); } $coordinate = new BaseCoordinate(array($args[0], $args[1])); $latitude = Latitude::fromNative($coordinate->getLatitude()); $longitude = Longitude::fromNative($coordinate->getLongitude()); $nativeEllipsoid = isset($args[2]) ? $args[2] : null; $ellipsoid = Ellipsoid::fromNative($nativeEllipsoid); return new static($latitude, $longitude, $ellipsoid); }
public function testNormalization() { $latitude = new Latitude(91); $this->assertEquals(90, $latitude->toNative()); }