/**
  * Renders the google map API.
  *
  * @param Ivory\GoogleMapBundle\Model\Map $map
  * @return string The google map API
  */
 protected function renderGoogleMapAPI(Map $map)
 {
     self::$apiIsLoaded = true;
     $url = 'http://maps.google.com/maps/api/js?';
     $encodedPolylines = $map->getEncodedPolylines();
     if (!empty($encodedPolylines)) {
         $url .= 'libraries=geometry&';
     }
     if ($map->isAsync()) {
         $url .= 'callback=load_ivory_google_map&';
     }
     $url .= sprintf('language=%s&sensor=false', $map->getLanguage());
     return sprintf('<script type="text/javascript" src="%s"></script>' . PHP_EOL, $url);
 }