예제 #1
0
 /**
  * Sets the size of the marker image.
  *
  * Available prototypes:
  *  - function setSize(Ivory\GoogleMap\Base\Size $size = null)
  *  - function setSize(double $width, double $height, string $widthUnit = null, string $heightUnit = null)
  *
  * @throws \Ivory\GoogleMap\Exception\OverlayException If the size is not valid.
  */
 public function setSize()
 {
     $args = func_get_args();
     if (isset($args[0]) && $args[0] instanceof Size) {
         $this->size = $args[0];
     } elseif (isset($args[0]) && is_numeric($args[0]) && (isset($args[1]) && is_numeric($args[1]))) {
         if ($this->size === null) {
             $this->size = new Size($args[0], $args[1]);
         }
         $this->size->setWidth($args[0]);
         $this->size->setHeight($args[1]);
         if (isset($args[2]) && is_string($args[2])) {
             $this->size->setWidthUnit($args[2]);
         }
         if (isset($args[3]) && is_string($args[3])) {
             $this->size->setHeightUnit($args[3]);
         }
     } elseif (!isset($args[0])) {
         $this->size = null;
     } else {
         throw OverlayException::invalidMarkerImageSize();
     }
 }