/** * Renders the map type control * * @param Ivory\GoogleMapBundle\Model\Controls\MapTypeControl $mapTypeControl * @return string HTML output */ public function render(MapTypeControl $mapTypeControl) { $mapTypeIds = array(); foreach ($mapTypeControl->getMapTypeIds() as $mapTypeId) { $mapTypeIds[] = $this->mapTypeIdHelper->render($mapTypeId); } return sprintf('{"mapTypeIds":[%s],"position":%s,"style":%s}', implode(', ', $mapTypeIds), $this->controlPositionHelper->render($mapTypeControl->getControlPosition()), $this->mapTypeControlStyleHelper->render($mapTypeControl->getMapTypeControlStyle())); }
/** * Checks the render method */ public function testRender() { $this->assertEquals(self::$mapTypeIdHelper->render(MapTypeId::HYBRID), 'google.maps.MapTypeId.HYBRID'); $this->assertEquals(self::$mapTypeIdHelper->render(MapTypeId::ROADMAP), 'google.maps.MapTypeId.ROADMAP'); $this->assertEquals(self::$mapTypeIdHelper->render(MapTypeId::SATELLITE), 'google.maps.MapTypeId.SATELLITE'); $this->assertEquals(self::$mapTypeIdHelper->render(MapTypeId::TERRAIN), 'google.maps.MapTypeId.TERRAIN'); $this->setExpectedException('InvalidArgumentException'); self::$mapTypeIdHelper->render('foo'); }