/** * Sets the map scale control. * * Available prototypes: * - function setScaleControl(Ivory\GoogleMap\Controls\ScaleControl $scaleControl = null) * - function setScaleControl(string $controlPosition, string $scaleControlStyle) * * @throws \Ivory\GoogleMap\Exception\MapException If the scale control is not valid (prototypes). */ public function setScaleControl() { $args = func_get_args(); if (isset($args[0]) && $args[0] instanceof ScaleControl) { $this->scaleControl = $args[0]; $this->mapOptions['scaleControl'] = true; } elseif (isset($args[0]) && is_string($args[0]) && (isset($args[1]) && is_string($args[1]))) { if ($this->scaleControl === null) { $this->scaleControl = new ScaleControl(); } $this->scaleControl->setControlPosition($args[0]); $this->scaleControl->setScaleControlStyle($args[1]); $this->mapOptions['scaleControl'] = true; } elseif (!isset($args[0])) { $this->scaleControl = null; if (isset($this->mapOptions['scaleControl'])) { unset($this->mapOptions['scaleControl']); } } else { throw MapException::invalidScaleControl(); } }
/** * @expectedException \Ivory\GoogleMap\Exception\ControlException */ public function testControlPositionWithInvalidValue() { $this->scaleControl->setControlPosition('foo'); }