Ipv4Visitor   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 13
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A visit() 0 6 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