Passed
Push — master ( 88fa1e...4a6728 )
by Philipp
07:30 queued 02:10
created

DomainParser::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 4
rs 10
1
<?php
2
3
namespace Pmochine\LaravelTongue\Misc;
4
5
use Pdp\Cache;
6
use Pdp\CurlHttpClient;
7
use Pdp\Domain;
8
use Pdp\Manager;
9
10
/**
11
 * Small wrapper for getting the getRegistrableDomain.
12
 */
13
class DomainParser
14
{
15
    /** @var Pdp\Rules */
0 ignored issues
show
Bug introduced by
The type Pmochine\LaravelTongue\Misc\Pdp\Rules was not found. Did you mean Pdp\Rules? If so, make sure to prefix the type with \.
Loading history...
16
    protected $rules;
17
18
    public function __construct()
19
    {
20
        $manager = new Manager(new Cache(), new CurlHttpClient());
21
        $this->rules = $manager->getRules();
0 ignored issues
show
Documentation Bug introduced by
It seems like $manager->getRules() of type Pdp\Rules is incompatible with the declared type Pmochine\LaravelTongue\Misc\Pdp\Rules of property $rules.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
22
    }
23
24
    /**
25
     * https://github.com/jeremykendall/php-domain-parser.
26
     *
27
     * @param   string  $url
28
     *
29
     * @return  Domain
30
     */
31
    public function resolve(string $url): Domain
32
    {
33
        return $this->rules->resolve($url);
34
    }
35
}
36