Host   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 2
c 1
b 0
f 1
lcom 0
cbo 3
dl 0
loc 14
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A fromNative() 0 8 2
1
<?php
2
3
/*
4
 * This file is part of the Cubiche package.
5
 *
6
 * Copyright (c) Cubiche
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Cubiche\Domain\Web;
13
14
use Cubiche\Domain\System\StringLiteral;
15
16
/**
17
 * Host class.
18
 *
19
 * @author Ivannis Suárez Jerez <[email protected]>
20
 */
21
abstract class Host extends StringLiteral
22
{
23
    /**
24
     * {@inheritdoc}
25
     */
26
    public static function fromNative($host)
27
    {
28
        if (filter_var($host, FILTER_VALIDATE_IP) !== false) {
29
            return new IPAddress($host);
30
        }
31
32
        return new HostName($host);
33
    }
34
}
35