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

Domain::getRegistrableDomain()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 1
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