| Total Complexity | 8 |
| Total Lines | 64 |
| Duplicated Lines | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 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 | /** |
||
| 22 | * @param string $url |
||
| 23 | * @param \DateTime $lastModifiedOn |
||
| 24 | * @param ChangeFrequency $changeFrequency |
||
| 25 | * @param int $priority |
||
| 26 | * @throws SitemapException |
||
| 27 | */ |
||
| 28 | public function __construct( |
||
| 29 | string $url, |
||
| 30 | \DateTime $lastModifiedOn, |
||
| 31 | ChangeFrequency $changeFrequency, |
||
| 32 | int $priority |
||
| 33 | ) { |
||
| 34 | $this->url = $url; |
||
| 35 | $this->lastModifiedOn = $lastModifiedOn; |
||
| 36 | $this->changeFrequency = $changeFrequency; |
||
| 37 | $this->setPriority($priority); |
||
| 38 | } |
||
| 39 | |||
| 40 | public function getChangeFrequency(): ChangeFrequency |
||
| 41 | { |
||
| 42 | return $this->changeFrequency; |
||
| 43 | } |
||
| 44 | |||
| 45 | public function getLastModifiedOn(): \DateTime |
||
| 46 | { |
||
| 47 | return $this->lastModifiedOn; |
||
| 48 | } |
||
| 49 | |||
| 50 | public function getPriority(): int |
||
| 51 | { |
||
| 52 | return $this->priority; |
||
| 53 | } |
||
| 54 | |||
| 55 | public function getUrl(): string |
||
| 56 | { |
||
| 57 | return $this->url; |
||
| 58 | } |
||
| 59 | |||
| 60 | /** |
||
| 61 | * @param int $priority |
||
| 62 | * @throws SitemapException |
||
| 63 | */ |
||
| 64 | private function setPriority(int $priority): void |
||
| 71 | } |
||
| 72 | } |
||
| 73 |