Coduo\TuTu\Request\HeadersMatchingPolicy::match PHP Method

match() public method

public match ( Request $request, Element $config ) : boolean
$request Symfony\Component\HttpFoundation\Request
$config Coduo\TuTu\Config\Element
return boolean
    public function match(Request $request, Element $config)
    {
        if (!$config->getRequest()->hasHeaders()) {
            return true;
        }
        foreach ($config->getRequest()->getHeaders() as $headerName => $headerValuePattern) {
            if (!$request->headers->has($headerName)) {
                return false;
            }
            if (!$this->phpMatcher->match($request->headers->get($headerName), $headerValuePattern)) {
                return false;
            }
        }
        return true;
    }
HeadersMatchingPolicy