Skip to content

Commit 8571b87

Browse files
committed
simplify parseHost as host validation is already handled within sub-methods
1 parent 22f93d2 commit 8571b87

File tree

1 file changed

+3
-16
lines changed

1 file changed

+3
-16
lines changed

src/Pdp/Parser.php

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -121,23 +121,10 @@ public function parseHost($host)
121121
{
122122
$host = mb_strtolower($host, 'UTF-8');
123123

124-
$subdomain = null;
125-
$registrableDomain = null;
126-
$publicSuffix = null;
127-
128-
// Fixes #22: Single label domains are set as Host::$host and all other
129-
// properties are null.
130-
// Fixes #43: Ip Addresses should not be parsed
131-
if ($this->isMultiLabelDomain($host) || !$this->isIpv4Address($host)) {
132-
$subdomain = $this->getSubdomain($host);
133-
$registrableDomain = $this->getRegistrableDomain($host);
134-
$publicSuffix = $this->getPublicSuffix($host);
135-
}
136-
137124
return new Host(
138-
$subdomain,
139-
$registrableDomain,
140-
$publicSuffix,
125+
$this->getSubdomain($host),
126+
$this->getRegistrableDomain($host),
127+
$this->getPublicSuffix($host),
141128
$host
142129
);
143130
}

0 commit comments

Comments
 (0)