/**
  * @param BreadcrumbItem $item
  * @param array          $variables
  * @return ProcessedBreadcrumbItem
  */
 public function process(BreadcrumbItem $item, $variables)
 {
     // Process the label
     if ($item->getLabel()[0] === '$') {
         $processedLabel = $this->parseValue($item->getLabel(), $variables);
     } else {
         $processedLabel = $this->translator->trans($item->getLabel());
     }
     // Process the route
     // TODO: cache parameters extracted from current request
     $params = [];
     foreach ($this->requestStack->getCurrentRequest()->attributes as $key => $value) {
         if ($key[0] !== '_') {
             $params[$key] = $value;
         }
     }
     foreach ($item->getRouteParams() ?: [] as $key => $value) {
         if ($value[0] === '$') {
             $params[$key] = $this->parseValue($value, $variables);
         } else {
             $params[$key] = $value;
         }
     }
     if ($item->getRoute() !== null) {
         $processedUrl = $this->router->generate($item->getRoute(), $params);
     } else {
         $processedUrl = null;
     }
     return new ProcessedBreadcrumbItem($processedLabel, $processedUrl);
 }
 /**
  * @covers ::__construct
  * @covers ::getLabel
  * @covers ::getRoute
  * @covers ::getRouteParams
  */
 public function test_constructor()
 {
     $item = new BreadcrumbItem('label', 'route', ['param' => 'value']);
     $this->assertEquals('label', $item->getLabel());
     $this->assertEquals('route', $item->getRoute());
     $this->assertEquals(['param' => 'value'], $item->getRouteParams());
 }