CrawlUrl::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 5
rs 10
cc 1
nc 1
nop 2
1
<?php
2
3
namespace Spatie\Crawler;
4
5
use Psr\Http\Message\UriInterface;
6
7
class CrawlUrl
8
{
9
    /** @var \Psr\Http\Message\UriInterface */
10
    public $url;
11
12
    /** @var \Psr\Http\Message\UriInterface */
13
    public $foundOnUrl;
14
15
    /** @var mixed */
16
    protected $id;
17
18
    public static function create(UriInterface $url, ?UriInterface $foundOnUrl = null, $id = null)
19
    {
20
        $static = new static($url, $foundOnUrl);
21
22
        if ($id !== null) {
23
            $static->setId($id);
24
        }
25
26
        return $static;
27
    }
28
29
    protected function __construct(UriInterface $url, $foundOnUrl = null)
30
    {
31
        $this->url = $url;
32
        $this->foundOnUrl = $foundOnUrl;
33
    }
34
35
    /**
36
     * @return mixed|null
37
     */
38
    public function getId()
39
    {
40
        return $this->id;
41
    }
42
43
    public function setId($id)
44
    {
45
        $this->id = $id;
46
    }
47
}
48