Conditions | 4 |
Paths | 5 |
Total Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
18 | public function visit($hostname, ParsedHostname $parsedHostname): void |
||
19 | { |
||
20 | $hostname = string($hostname); |
||
21 | if (!$parsedHostname->isIp()) { |
||
22 | $suffix = $parsedHostname->getSuffix(); |
||
23 | $withoutSuffix = null !== $suffix ? $hostname->removeRight(\sprintf('.%s', $suffix)) : $hostname; |
||
24 | if ($withoutSuffix->contains('.')) { |
||
25 | $domainParts = \explode('.', (string) $withoutSuffix); |
||
26 | $parsedHostname->setDomain(\array_pop($domainParts)); |
||
27 | $parsedHostname->setSubdomain(\implode('.', $domainParts)); |
||
28 | } else { |
||
29 | $parsedHostname->setDomain((string) $withoutSuffix); |
||
30 | } |
||
31 | } |
||
32 | } |
||
33 | } |
||
34 |