Esempio n. 1
0
 /**
  * @since 3.0
  *
  * @param LatLongValue $rectangleNorthEast
  * @param LatLongValue $rectangleSouthWest
  *
  * @throws InvalidArgumentException
  */
 public function __construct(LatLongValue $rectangleNorthEast, LatLongValue $rectangleSouthWest)
 {
     if ($rectangleNorthEast->equals($rectangleSouthWest)) {
         throw new InvalidArgumentException('$rectangleNorthEast cannot be equal to $rectangleSouthWest');
     }
     parent::__construct();
     // TODO: validate bounds are correct, if not, flip
     $this->setRectangleNorthEast($rectangleNorthEast);
     $this->setRectangleSouthWest($rectangleSouthWest);
 }
Esempio n. 2
0
 /**
  * @param LatLongValue $circleCentre
  * @param integer|float $circleRadius
  *
  * @throws InvalidArgumentException
  */
 public function __construct(LatLongValue $circleCentre, $circleRadius)
 {
     if (!is_float($circleRadius) && !is_int($circleRadius)) {
         throw new InvalidArgumentException('$circleRadius must be a float or int');
     }
     if ($circleRadius <= 0) {
         throw new InvalidArgumentException('$circleRadius must be greater than zero');
     }
     parent::__construct();
     $this->setCircleCentre($circleCentre);
     $this->setCircleRadius($circleRadius);
 }