public function match(ServerRequestInterface $request) { $matcher = new PlaceholderRequestMatcher($this->path, $this->constraints); $params = $matcher->match($request); if ($params === false) { return false; } return new RouteData($this->name, array_merge($params + $this->defaults, $this->values), $this->handler); }
public function match(ServerRequestInterface $request) { $language = $request->getAttribute('_language', null); $path = $this->translations->getTranslation($language) ?: $this->path; $matcher = new PlaceholderRequestMatcher($path, $this->constraints); $params = $matcher->match($request); if ($params === false) { return false; } if ($language) { foreach ($params as $name => &$value) { if (is_array($value)) { foreach ($value as &$v) { $v = $this->translations->translatePlaceholderValue($name, $v, $language, true) ?: $v; } } else { $value = $this->translations->translatePlaceholderValue($name, $value, $language, true) ?: $value; } } } return new RouteData($this->name, array_merge($params + $this->defaults, $this->values), $this->handler); }