/** * Sets the overview map control. * * Available prototypes: * - function setOverviewMapControl(Ivory\GoogleMap\Controls\OverviewMapControl $overviewMapControl = null) * - function setOverviewMapControl(boolean $opened) * * @throws \Ivory\GoogleMap\Exception\MapException If the overview map control is not valid (prototypes). */ public function setOverviewMapControl() { $args = func_get_args(); if (isset($args[0]) && $args[0] instanceof OverviewMapControl) { $this->overviewMapControl = $args[0]; $this->mapOptions['overviewMapControl'] = true; } elseif (isset($args[0]) && is_bool($args[0])) { if ($this->overviewMapControl === null) { $this->overviewMapControl = new OverviewMapControl(); } $this->overviewMapControl->setOpened($args[0]); $this->mapOptions['overviewMapControl'] = true; } elseif (!isset($args[0])) { $this->overviewMapControl = null; if (isset($this->mapOptions['overviewMapControl'])) { unset($this->mapOptions['overviewMapControl']); } } else { throw MapException::invalidOverviewMapControl(); } }
/** * Renders an overview map control. * * @param \Ivory\GoogleMap\Controls\OverviewMapControl $overviewMapControl The overview map control. * * @return string The JS output. */ public function render(OverviewMapControl $overviewMapControl) { return $this->jsonBuilder->reset()->setValue('[opened]', $overviewMapControl->isOpened())->build(); }
/** * @expectedException \Ivory\GoogleMap\Exception\ControlException * @expectedExceptionMessage The opened property of an overview map control must be a boolean value. */ public function testOpenedWithInvalidValue() { $this->overviewMapControl->setOpened('foo'); }