Ipv4Visitor::visit()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 2
1
<?php
2
3
namespace BenTools\HostnameExtractor\Visitor;
4
5
use BenTools\HostnameExtractor\ParsedHostname;
6
7
/**
8
 * Class Ipv4Visitor
9
 * @internal
10
 */
11
final class Ipv4Visitor implements HostnameVisitorInterface
12
{
13
14
    /**
15
     * @inheritDoc
16
     */
17
    public function visit($hostname, ParsedHostname $parsedHostname): void
18
    {
19
        if (false !== \filter_var((string) $hostname, FILTER_VALIDATE_IP)) {
20
            $parsedHostname->setIsIpv4(true);
21
        }
22
    }
23
}
24