Total Complexity | 9 |
Total Lines | 68 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
8 | class Sitemap |
||
9 | { |
||
10 | /** @var array */ |
||
11 | protected $tags = []; |
||
12 | |||
13 | /** |
||
14 | * @return static |
||
15 | */ |
||
16 | public static function create() |
||
17 | { |
||
18 | return new static(); |
||
19 | } |
||
20 | |||
21 | /** |
||
22 | * @param string|\safaeean\Sitemap\Tags\Tag $tag |
||
23 | * |
||
24 | * @return $this |
||
25 | */ |
||
26 | public function add($tag) |
||
27 | { |
||
28 | if (is_string($tag)) { |
||
29 | $tag = Url::create($tag); |
||
30 | } |
||
31 | |||
32 | $this->tags[] = $tag; |
||
33 | |||
34 | return $this; |
||
35 | } |
||
36 | |||
37 | /** |
||
38 | * @param string $url |
||
39 | * |
||
40 | * @return \safaeean\Sitemap\Tags\Url|null |
||
41 | */ |
||
42 | public function getUrl(string $url) |
||
46 | }); |
||
47 | } |
||
48 | |||
49 | public function hasUrl(string $url): bool |
||
52 | } |
||
53 | |||
54 | public function render($sort = false): string |
||
64 | } |
||
65 | |||
66 | /** |
||
67 | * @param string $path |
||
68 | * |
||
69 | * @return $this |
||
70 | */ |
||
71 | public function writeToFile(string $path) |
||
78 |