Beispiel #1
0
 /**
  * Sets the marker shape.
  *
  * Available prototypes:
  *  - function setShape(Ivory\GoogleMap\Overlays\MarkerShape $shape = null)
  *  - function setShape(string $type, array $coordinates)
  *
  * @throws \Ivory\GoogleMap\Exception\OverlayException If the shape is not valid.
  */
 public function setShape()
 {
     $args = func_get_args();
     if (isset($args[0]) && $args[0] instanceof MarkerShape) {
         if (!$args[0]->hasCoordinates()) {
             throw OverlayException::invalidMarkerShapeCoordinates();
         }
         $this->shape = $args[0];
     } elseif (isset($args[0]) && is_string($args[0]) && (isset($args[1]) && is_array($args[1]))) {
         if ($this->shape === null) {
             $this->shape = new MarkerShape();
         }
         $this->shape->setType($args[0]);
         $this->shape->setCoordinates($args[1]);
     } elseif (!isset($args[0])) {
         $this->shape = null;
     } else {
         throw OverlayException::invalidMarkerShape();
     }
 }