Domain   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 3
dl 0
loc 17
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A specifyType() 0 8 2
1
<?php
2
3
namespace ValueObjects\Web;
4
5
use ValueObjects\StringLiteral\StringLiteral;
6
7
abstract class Domain extends StringLiteral
8
{
9
    /**
10
     * Returns a Hostname or a IPAddress object depending on passed value
11
     *
12
     * @param $domain
13
     * @return Hostname|IPAddress
14
     */
15 4
    public static function specifyType($domain)
16
    {
17 4
        if (false !== filter_var($domain, FILTER_VALIDATE_IP)) {
18 1
            return new IPAddress($domain);
19
        }
20
21 4
        return new Hostname($domain);
22
    }
23
}
24