/**
  * @param string $resource
  * @param null   $type
  *
  * @return \Symfony\Component\Routing\RouteCollection
  */
 public function load($resource, $type = null)
 {
     $collection = new SymfonyRouteCollection();
     try {
         $results = $this->manager->findAllAlias();
     } catch (\Exception $e) {
         return $collection;
     }
     foreach ($results as $metatag) {
         if (is_array($metatag['pathinfo'])) {
             $pathinfo = $metatag['pathinfo'];
         } else {
             $pathinfo = @unserialize($metatag['pathinfo']);
         }
         if (!is_array($pathinfo) || !isset($pathinfo['_route']) || !isset($metatag['alias'])) {
             continue;
         }
         $oldroute = $pathinfo['_route'];
         //add defaults to routealias
         if (isset($pathinfo['__defaults']) && is_array($pathinfo['__defaults'])) {
             foreach ($pathinfo['__defaults'] as $key => $value) {
                 if (strpos($key, '_') !== 0) {
                     $metatag['alias'] .= '-{' . $key . '}';
                 }
             }
         }
         $route = new Route($metatag['alias'], $pathinfo, array(), array());
         $collection->add(self::getRouteName($oldroute, $pathinfo), $route);
     }
     return $collection;
 }
 public function metaTagsHtml($defaults = true, array $arguments = array(), $canonical = true)
 {
     $locale = $this->translator->getLocale();
     $currentLang = substr($locale, 0, 2);
     if (!isset($arguments['pre'])) {
         $arguments['pre'] = sprintf("\n%8s", ' ');
     }
     $headers = self::initMetaTagString();
     if ($defaults) {
         $headers .= $arguments['pre'] . '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />';
         $headers .= $arguments['pre'] . '<meta http-equiv="content-language" content="' . $currentLang . '" />';
         $headers .= $arguments['pre'] . '<meta name="DC.language" scheme="RFC3066" content="' . $currentLang . '" />';
     }
     $key = $this->keyGenerator->generateMetaTagKey($this->container->get('request'), $this->container->get('router'), $locale);
     $obj = $this->manager->findMetaTag($key, $locale);
     if ($obj) {
         $headers .= $this->metaTagToHtml($obj, $arguments);
     } else {
         $tags = $arguments;
         unset($tags['pre']);
         $headers .= MetaTagToHtmlRenderer::createMetaTags($arguments['pre'], $tags, $this);
     }
     if ($canonical) {
         $headers .= $arguments['pre'] . $this->canonicalTagsHtml($this->getRequest()->getPathInfo());
     }
     return $headers;
 }