Skip to content

Commit 45c89d2

Browse files
committed
Merge pull request #96 from mikegreiling/code_cleanup
Remove superfluous code
2 parents 151e09c + 8571b87 commit 45c89d2

File tree

1 file changed

+4
-17
lines changed

1 file changed

+4
-17
lines changed

src/Pdp/Parser.php

Lines changed: 4 additions & 17 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
}
@@ -259,7 +246,7 @@ public function isSuffixValid($host)
259246
*/
260247
public function getRegistrableDomain($host)
261248
{
262-
if (strpos($host, '.') === false) {
249+
if (!$this->isMultiLabelDomain($host)) {
263250
return;
264251
}
265252

0 commit comments

Comments
 (0)