@api
Overrides RequestMatcherInterface::matches
public function matches(Request $request) {
if (null !== $this->methods && !in_array($request
->getMethod(), $this->methods)) {
return false;
}
foreach ($this->attributes as $key => $pattern) {
if (!preg_match('#' . str_replace('#', '\\#', $pattern) . '#', $request->attributes
->get($key))) {
return false;
}
}
if (null !== $this->path) {
$path = str_replace('#', '\\#', $this->path);
if (!preg_match('#' . $path . '#', rawurldecode($request
->getPathInfo()))) {
return false;
}
}
if (null !== $this->host && !preg_match('#' . str_replace('#', '\\#', $this->host) . '#', $request
->getHost())) {
return false;
}
if (null !== $this->ip && !$this
->checkIp($request
->getClientIp(), $this->ip)) {
return false;
}
return true;
}