Exemplo n.º 1
0
 /**
  * @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 new InvalidValueException(sprintf('Invalid latitude value "%s", must be in range -90 to 90.', $y));
     }
     $this->y = $y;
     return $this;
 }
Exemplo n.º 2
0
 /**
  * @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;
 }
Exemplo n.º 3
0
 /**
  * @param string $input
  * @param string $exception
  * @param string $message
  *
  * @dataProvider dataSourceBad
  */
 public function testBadValues($input, $exception, $message)
 {
     $this->setExpectedException($exception, $message);
     $parser = new Parser($input);
     $parser->parse();
 }
Exemplo n.º 4
0
 /**
  * @param mixed $y
  *
  * @return self
  * @throws InvalidValueException
  */
 public function setY($y)
 {
     $parser = new Parser($y);
     try {
         $this->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());
     }
     return $this;
 }