Total Complexity | 8 |
Total Lines | 57 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
7 | class SitemapItem |
||
8 | { |
||
9 | /** @var ChangeFrequency */ |
||
10 | private $changeFrequency; |
||
11 | |||
12 | /** @var \DateTime */ |
||
13 | private $lastModifiedOn; |
||
14 | |||
15 | /** @var int - Value between 0 and 10, will be divided by 10 */ |
||
16 | private $priority = 10; |
||
17 | |||
18 | /** @var string */ |
||
19 | private $url; |
||
20 | |||
21 | public function __construct( |
||
22 | string $url, |
||
23 | \DateTime $lastModifiedOn, |
||
24 | ChangeFrequency $changeFrequency, |
||
25 | int $priority = 5 |
||
26 | ) { |
||
27 | $this->url = $url; |
||
28 | $this->lastModifiedOn = $lastModifiedOn; |
||
29 | $this->changeFrequency = $changeFrequency; |
||
30 | $this->setPriority($priority); |
||
31 | } |
||
32 | |||
33 | public function getChangeFrequency(): ChangeFrequency |
||
34 | { |
||
35 | return $this->changeFrequency; |
||
36 | } |
||
37 | |||
38 | public function getLastModifiedOn(): \DateTime |
||
39 | { |
||
40 | return $this->lastModifiedOn; |
||
41 | } |
||
42 | |||
43 | public function getPriority(): int |
||
44 | { |
||
45 | return $this->priority; |
||
46 | } |
||
47 | |||
48 | public function getUrl(): string |
||
49 | { |
||
50 | return $this->url; |
||
51 | } |
||
52 | |||
53 | /** |
||
54 | * @param int $priority |
||
55 | * @throws SitemapException |
||
56 | */ |
||
57 | private function setPriority(int $priority): void |
||
64 | } |
||
65 | } |
||
66 |