/**
  * Create the request url.
  *
  * It combines the params and creates an hash for it.
  *
  * @param int         $dataId The data object id.
  * @param string|null $type   Object type. If empty it assumes a layer.
  * @param string|null $format Data format. If empty it assumes geojson.
  * @param Filter      $filter Optional filter.
  *
  * @return RequestUrl
  */
 public static function create($dataId, $type = null, $format = null, Filter $filter = null)
 {
     $params = array('for' => static::$for, 'type' => $type != 'layer' ? $type : null, 'id' => $dataId, 'format' => $format != 'geojson' ? $format : null);
     $hash = base64_encode(implode(',', $params));
     $query = 'leaflet=' . $hash;
     if ($filter) {
         $query .= '&f=' . $filter->getName() . '&v=' . $filter->toRequest();
     }
     $url = \Config::get('websitePath') . '/' . \Frontend::addToUrl($query, false);
     return new static($url, $hash, $filter);
 }
 /**
  * Get the cache key.
  *
  * @param int         $mapId     The map database id.
  * @param Filter|null $filter    Optional request filter.
  * @param string      $elementId Optional element id. If none given the mapId or alias is used.
  * @param string      $template  The template being used for generating.
  * @param string      $style     Optional style attributes.
  *
  * @return string
  */
 protected function getCacheKey($mapId, $filter, $elementId, $template, $style)
 {
     $cacheKey = 'map_' . $mapId;
     if ($filter) {
         $cacheKey .= '.filter_' . md5($filter->toRequest());
     }
     if ($elementId) {
         $cacheKey .= '.element_' . $elementId;
     }
     $cacheKey .= '.template_' . $template;
     if ($style) {
         $cacheKey .= '.style_' . md5($style);
         return $cacheKey;
     }
     return $cacheKey;
 }