1 | <?php |
||
8 | class Url extends Tag |
||
9 | { |
||
10 | const CHANGE_FREQUENCY_ALWAYS = 'always'; |
||
11 | const CHANGE_FREQUENCY_HOURLY = 'hourly'; |
||
12 | const CHANGE_FREQUENCY_DAILY = 'daily'; |
||
13 | const CHANGE_FREQUENCY_WEEKLY = 'weekly'; |
||
14 | const CHANGE_FREQUENCY_MONTHLY = 'monthly'; |
||
15 | const CHANGE_FREQUENCY_YEARLY = 'yearly'; |
||
16 | const CHANGE_FREQUENCY_NEVER = 'never'; |
||
17 | |||
18 | /** @var string */ |
||
19 | public $url = ''; |
||
20 | |||
21 | /** @var \Carbon\Carbon */ |
||
22 | public $lastModificationDate; |
||
23 | |||
24 | /** @var string */ |
||
25 | public $changeFrequency; |
||
26 | |||
27 | /** @var float */ |
||
28 | public $priority = 0.8; |
||
29 | |||
30 | /** @var array */ |
||
31 | public $alternates = []; |
||
32 | |||
33 | public static function create(string $url): self |
||
37 | |||
38 | public function __construct(string $url) |
||
46 | |||
47 | /** |
||
48 | * @param string $url |
||
49 | * |
||
50 | * @return $this |
||
51 | */ |
||
52 | public function setUrl(string $url = '') |
||
58 | |||
59 | /** |
||
60 | * @param \DateTime $lastModificationDate |
||
61 | * |
||
62 | * @return $this |
||
63 | */ |
||
64 | public function setLastModificationDate(DateTime $lastModificationDate) |
||
70 | |||
71 | /** |
||
72 | * @param string $changeFrequency |
||
73 | * |
||
74 | * @return $this |
||
75 | */ |
||
76 | public function setChangeFrequency(string $changeFrequency) |
||
82 | |||
83 | /** |
||
84 | * @param float $priority |
||
85 | * |
||
86 | * @return $this |
||
87 | */ |
||
88 | public function setPriority(float $priority) |
||
94 | |||
95 | /** |
||
96 | * @param Alternate $alternate |
||
97 | * |
||
98 | * @param string $url |
||
99 | * @param string $locale |
||
100 | * @return $this |
||
101 | */ |
||
102 | public function addAlternate(string $url, string $locale = '') |
||
108 | |||
109 | /** |
||
110 | * @return string |
||
111 | */ |
||
112 | public function path(): string |
||
116 | |||
117 | /** |
||
118 | * @param int|null $index |
||
119 | * |
||
120 | * @return array|null|string |
||
121 | */ |
||
122 | public function segments(int $index = null) |
||
137 | |||
138 | /** |
||
139 | * @param int $index |
||
140 | * |
||
141 | * @return string|null |
||
142 | */ |
||
143 | public function segment(int $index) |
||
147 | } |
||
148 |
Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a given class or a super-class is assigned to a property that is type hinted more strictly.
Either this assignment is in error or an instanceof check should be added for that assignment.