Passed
Push — master ( 9abeb8...36c770 )
by Dev
13:09
created

Domain   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 7
c 1
b 0
f 0
dl 0
loc 21
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getRegistrableDomain() 0 3 1
A resolve() 0 3 1
A getRules() 0 7 2
1
<?php
2
3
/**
4
 * Entity.
5
 */
6
7
namespace PiedWeb\UrlHarvester;
8
9
use Pdp\Cache;
10
use Pdp\CurlHttpClient;
11
use Pdp\Manager;
12
13
class Domain
14
{
15
    protected static $rules;
16
17
    public static function resolve(string $host): \Pdp\Domain
18
    {
19
        return self::getRules()->resolve($host);
20
    }
21
22
    public static function getRegistrableDomain(string $host): ?string
23
    {
24
        return self::resolve($host)->getRegistrableDomain();
25
    }
26
27
    protected static function getRules()
28
    {
29
        if (null !== self::$rules) {
30
            return self::$rules;
31
        }
32
33
        return self::$rules = (new Manager(new Cache(), new CurlHttpClient()))->getRules();
34
    }
35
}
36