class RequestMatcher implements RequestMatcherInterface

RequestMatcher compares a pre-defined set of checks against a Request instance.

Methods

__construct(string|null $path = null, string|null $host = null, string|string[]|null $methods = null, string|string[]|null $ips = null, array $attributes = array(), string|string[]|null $schemes = null)

No description

matchScheme(string|string[]|null $scheme)

Adds a check for the HTTP scheme.

matchHost(string|null $regexp)

Adds a check for the URL host name.

matchPath(string|null $regexp)

Adds a check for the URL path info.

matchIp(string $ip)

Adds a check for the client IP.

matchIps(string|string[]|null $ips)

Adds a check for the client IP.

matchMethod(string|string[]|null $method)

Adds a check for the HTTP method.

matchAttribute(string $key, string $regexp)

Adds a check for request attribute.

bool
matches(Request $request)

Decides whether the rule(s) implemented by the strategy matches the supplied request.

Details

at line line 59
__construct(string|null $path = null, string|null $host = null, string|string[]|null $methods = null, string|string[]|null $ips = null, array $attributes = array(), string|string[]|null $schemes = null)

Parameters

string|null $path
string|null $host
string|string[]|null $methods
string|string[]|null $ips
array $attributes
string|string[]|null $schemes

at line line 77
matchScheme(string|string[]|null $scheme)

Adds a check for the HTTP scheme.

Parameters

string|string[]|null $scheme An HTTP scheme or an array of HTTP schemes

at line line 87
matchHost(string|null $regexp)

Adds a check for the URL host name.

Parameters

string|null $regexp A Regexp

at line line 97
matchPath(string|null $regexp)

Adds a check for the URL path info.

Parameters

string|null $regexp A Regexp

at line line 107
matchIp(string $ip)

Adds a check for the client IP.

Parameters

string $ip A specific IP address or a range specified using IP/netmask like 192.168.1.0/24

at line line 117
matchIps(string|string[]|null $ips)

Adds a check for the client IP.

Parameters

string|string[]|null $ips A specific IP address or a range specified using IP/netmask like 192.168.1.0/24

at line line 127
matchMethod(string|string[]|null $method)

Adds a check for the HTTP method.

Parameters

string|string[]|null $method An HTTP method or an array of HTTP methods

at line line 138
matchAttribute(string $key, string $regexp)

Adds a check for request attribute.

Parameters

string $key The request attribute name
string $regexp A Regexp

at line line 146
bool matches(Request $request)

Decides whether the rule(s) implemented by the strategy matches the supplied request.

Parameters

Request $request The request to check for a match

Return Value

bool true if the request matches, false otherwise