/** * Sets the map type control. * * Available prototypes: * - function setMapTypeControl(Ivory\GoogleMap\Controls\MapTypeControl $mapTypeControl = null) * - function setMaptypeControl(array $mapTypeIds, string $controlPosition, string $mapTypeControlStyle) * * @throws \Ivory\GoogleMap\Exception\MapException If the map type control is not valid (prototypes). */ public function setMapTypeControl() { $args = func_get_args(); if (isset($args[0]) && $args[0] instanceof MapTypeControl) { $this->mapTypeControl = $args[0]; $this->mapOptions['mapTypeControl'] = true; } elseif (isset($args[0]) && is_array($args[0]) && (isset($args[1]) && is_string($args[1])) && (isset($args[2]) && is_string($args[2]))) { if ($this->mapTypeControl === null) { $this->mapTypeControl = new MapTypeControl(); } $this->mapTypeControl->setMapTypeIds($args[0]); $this->mapTypeControl->setControlPosition($args[1]); $this->mapTypeControl->setMapTypeControlStyle($args[2]); $this->mapOptions['mapTypeControl'] = true; } elseif (!isset($args[0])) { $this->mapTypeControl = null; if (isset($this->mapOptions['mapTypeControl'])) { unset($this->mapOptions['mapTypeControl']); } } else { throw MapException::invalidMapTypeControl(); } }
/** * @expectedException \Ivory\GoogleMap\Exception\ControlException * @expectedExceptionMessage The control position can only be : bottom_center, bottom_left, bottom_right, * left_bottom, left_center, left_top, right_bottom, right_center, right_top, top_center, top_left, top_right. */ public function testControlPositionWithInvalidValue() { $this->mapTypeControl->setControlPosition('foo'); }