/** * Renders the encoded polyline * * @param Ivory\GoogleMapBundle\Model\Overlays\EncodedPolyline $encodedPolyline * @param Ivory\GoogleMapBundle\Model\Map $map * @return string HTML output */ public function render(EncodedPolyline $encodedPolyline, Map $map) { $polylineOptions = $encodedPolyline->getOptions(); $polylineJSONOptions = sprintf('{"map":%s,"path":%s', $map->getJavascriptVariable(), $this->encodingHelper->renderDecodePath($encodedPolyline->getValue())); if (!empty($polylineOptions)) { $polylineJSONOptions .= ',' . substr(json_encode($polylineOptions), 1); } else { $polylineJSONOptions .= '}'; } return sprintf('var %s = new google.maps.Polyline(%s);' . PHP_EOL, $encodedPolyline->getJavascriptVariable(), $polylineJSONOptions); }
/** * Create an encoded polyline * * @param string $value */ public function __construct($value = null) { parent::__construct($value); }
/** * Checks the value getter & setter */ public function testValue() { $this->assertEquals(self::$encodedPolyline->getValue(), 'value'); $this->setExpectedException('InvalidArgumentException'); self::$encodedPolyline->setValue(true); }