示例#1
0
 /**
  * Sets the map zoom control.
  *
  * Available prototypes:
  *  - function setZoomControl(Ivory\GoogleMap\Controls\ZoomControl $zoomControl = null)
  *  - function setZoomControl(string $controlPosition, string $zoomControlStyle)
  *
  * @throws \Ivory\GoogleMap\Exception\MapException If the zoom control is not valid (prototypes).
  */
 public function setZoomControl()
 {
     $args = func_get_args();
     if (isset($args[0]) && $args[0] instanceof ZoomControl) {
         $this->zoomControl = $args[0];
         $this->mapOptions['zoomControl'] = true;
     } elseif (isset($args[0]) && is_string($args[0]) && (isset($args[1]) && is_string($args[1]))) {
         if ($this->zoomControl === null) {
             $this->zoomControl = new ZoomControl();
         }
         $this->zoomControl->setControlPosition($args[0]);
         $this->zoomControl->setZoomControlStyle($args[1]);
         $this->mapOptions['zoomControl'] = true;
     } elseif (!isset($args[0])) {
         $this->zoomControl = null;
         if (isset($this->mapOptions['zoomControl'])) {
             unset($this->mapOptions['zoomControl']);
         }
     } else {
         throw MapException::invalidZoomControl();
     }
 }
 /**
  * @expectedException \Ivory\GoogleMap\Exception\ControlException
  * @expectedExceptionMessage The zoom control style of a zoom control can only be : default, large, small.
  */
 public function testZoomControlStyleWithInvalidValue()
 {
     $this->zoomControl->setZoomControlStyle('foo');
 }