Пример #1
0
 /**
  * @param string $_format The format of the sitemap.
  *
  * @return Response
  */
 public function indexAction($_format)
 {
     $supportedFormats = array_merge(array('json'), array_keys($this->templates));
     if (!in_array($_format, $supportedFormats)) {
         $text = sprintf('Unknown format %s, use one of %s.', $_format, implode(', ', $supportedFormats));
         return new Response($text, 406);
     }
     $urls = $this->urlProvider->getUrlInformation();
     if (isset($this->templates[$_format])) {
         return new Response($this->templating->render($this->templates[$_format], array('urls' => $urls)));
     }
     return $this->createJsonResponse($urls);
 }