Completed
Push — master ( fd00ec...b10e46 )
by Christian
79:20 queued 20:27
created

Url   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 103
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

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

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A getChangeFreq() 0 4 1
A getLastMod() 0 4 1
A getLoc() 0 4 1
A getPriority() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * (c) Christian Gripp <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Core23\SitemapBundle\Model;
13
14
class Url implements UrlInterface
15
{
16
    /**
17
     * Always visit url.
18
     */
19
    public const FREQUENCE_ALWAYS = 'always';
20
21
    /**
22
     * Visit url every hour.
23
     */
24
    public const FREQUENCE_HOURLY = 'hourly';
25
26
    /**
27
     * Visit url every day.
28
     */
29
    public const FREQUENCE_DAILY = 'daily';
30
31
    /**
32
     * Visit url every week.
33
     */
34
    public const FREQUENCE_WEEKLY = 'weekly';
35
36
    /**
37
     * Visit url every month.
38
     */
39
    public const FREQUENCE_MONTHLY = 'monthly';
40
41
    /**
42
     * Visit url every year.
43
     */
44
    public const FREQUENCE_YEARLY = 'yearly';
45
46
    /**
47
     * Never visit url again.
48
     */
49
    public const FREQUENCE_NEVER = 'never';
50
51
    /**
52
     * @var string
53
     */
54
    protected $loc;
55
56
    /**
57
     * @var \DateTime|null
58
     */
59
    protected $lastMod;
60
61
    /**
62
     * @var string|null
63
     */
64
    protected $changeFreq;
65
66
    /**
67
     * @var int|null
68
     */
69
    protected $priority;
70
71
    /**
72
     * @param string         $loc
73
     * @param int|null       $priority
74
     * @param null|string    $changeFreq
75
     * @param \DateTime|null $lastMod
76
     */
77
    public function __construct(string $loc, ?int $priority = null, ?string $changeFreq = null, ?\DateTime $lastMod = null)
78
    {
79
        $this->loc        = $loc;
80
        $this->lastMod    = $lastMod;
81
        $this->changeFreq = $changeFreq;
82
        $this->priority   = $priority;
83
    }
84
85
    /**
86
     * {@inheritdoc}
87
     */
88
    public function getChangeFreq(): ?string
89
    {
90
        return $this->changeFreq;
91
    }
92
93
    /**
94
     * {@inheritdoc}
95
     */
96
    public function getLastMod(): ?\DateTime
97
    {
98
        return $this->lastMod;
99
    }
100
101
    /**
102
     * {@inheritdoc}
103
     */
104
    public function getLoc(): string
105
    {
106
        return $this->loc;
107
    }
108
109
    /**
110
     * {@inheritdoc}
111
     */
112
    public function getPriority(): ?int
113
    {
114
        return $this->priority;
115
    }
116
}
117