CrawlUrl   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 0
dl 0
loc 41
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A create() 0 10 2
A __construct() 0 5 1
A getId() 0 4 1
A setId() 0 4 1
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