diff options
| author | Greg Roach <fisharebest@webtrees.net> | 2018-12-01 17:57:53 +0000 |
|---|---|---|
| committer | Greg Roach <fisharebest@webtrees.net> | 2018-12-01 18:56:03 +0000 |
| commit | e70f282ef978b175c5529f439f3b572c5b8531a2 (patch) | |
| tree | cc022e973d89a5507dcbb35561ef93852c551dff /vendor/symfony/http-foundation/RequestMatcher.php | |
| parent | c16be598f1a8d42127bd64c4878bd92297e18f3b (diff) | |
| download | webtrees-e70f282ef978b175c5529f439f3b572c5b8531a2.tar.gz webtrees-e70f282ef978b175c5529f439f3b572c5b8531a2.tar.bz2 webtrees-e70f282ef978b175c5529f439f3b572c5b8531a2.zip | |
Update minimum version of PHP to 7.1
Diffstat (limited to 'vendor/symfony/http-foundation/RequestMatcher.php')
| -rw-r--r-- | vendor/symfony/http-foundation/RequestMatcher.php | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/vendor/symfony/http-foundation/RequestMatcher.php b/vendor/symfony/http-foundation/RequestMatcher.php index 6b4cef147d..ab9434f43f 100644 --- a/vendor/symfony/http-foundation/RequestMatcher.php +++ b/vendor/symfony/http-foundation/RequestMatcher.php @@ -29,6 +29,11 @@ class RequestMatcher implements RequestMatcherInterface private $host; /** + * @var int|null + */ + private $port; + + /** * @var string[] */ private $methods = array(); @@ -56,13 +61,14 @@ class RequestMatcher implements RequestMatcherInterface * @param array $attributes * @param string|string[]|null $schemes */ - public function __construct($path = null, $host = null, $methods = null, $ips = null, array $attributes = array(), $schemes = null) + public function __construct(string $path = null, string $host = null, $methods = null, $ips = null, array $attributes = array(), $schemes = null, int $port = null) { $this->matchPath($path); $this->matchHost($host); $this->matchMethod($methods); $this->matchIps($ips); $this->matchScheme($schemes); + $this->matchPort($port); foreach ($attributes as $k => $v) { $this->matchAttribute($k, $v); @@ -90,6 +96,16 @@ class RequestMatcher implements RequestMatcherInterface } /** + * Adds a check for the the URL port. + * + * @param int|null $port The port number to connect to + */ + public function matchPort(int $port = null) + { + $this->port = $port; + } + + /** * Adds a check for the URL path info. * * @param string|null $regexp A Regexp @@ -167,6 +183,10 @@ class RequestMatcher implements RequestMatcherInterface return false; } + if (null !== $this->port && 0 < $this->port && $request->getPort() !== $this->port) { + return false; + } + if (IpUtils::checkIp($request->getClientIp(), $this->ips)) { return true; } |
