/** * {@inheritdoc} */ public function setY($y) { $y = $this->toFloat($y); if ($y < -90 || $y > 90) { throw InvalidValueException::invalidLatitude($y); } $this->y = $y; return $this; }
/** * @param mixed $y * * @return self * @throws InvalidValueException */ public function setY($y) { $parser = new Parser($y); try { $y = (double) $parser->parse(); } catch (RangeException $e) { throw new InvalidValueException($e->getMessage(), $e->getCode(), $e->getPrevious()); } catch (UnexpectedValueException $e) { throw new InvalidValueException($e->getMessage(), $e->getCode(), $e->getPrevious()); } if ($y < -90 || $y > 90) { throw InvalidValueException::invalidLatitude($y); } $this->y = $y; return $this; }