Completed
Pull Request — master (#87)
by Peter
01:11
created

CrawlUrl::getId()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

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