| Total Complexity | 6 |
| Total Lines | 42 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 9 | class SitemapProvider |
||
| 10 | { |
||
| 11 | /** @var SitemapItems */ |
||
| 12 | private $items; |
||
| 13 | |||
| 14 | /** @var string - bvb: NewsArticle, will create a "sitemap_NewsArticle.xml" file */ |
||
| 15 | private $key; |
||
| 16 | |||
| 17 | public function __construct(string $key) |
||
| 21 | } |
||
| 22 | |||
| 23 | public function getItems(): SitemapItems |
||
| 26 | } |
||
| 27 | |||
| 28 | public function getFilename(): string |
||
| 29 | { |
||
| 30 | try { |
||
| 31 | $suffix = (new \ReflectionClass($this->getKey()))->getShortName(); |
||
| 32 | } catch (\Exception $e) { |
||
| 33 | $suffix = array_pop(explode('\\', $this->getKey())); |
||
|
|
|||
| 34 | } |
||
| 35 | |||
| 36 | return 'sitemap_' . $suffix; |
||
| 37 | } |
||
| 38 | |||
| 39 | public function getKey(): string |
||
| 40 | { |
||
| 41 | return $this->key; |
||
| 42 | } |
||
| 43 | |||
| 44 | public function createItem( |
||
| 51 | } |
||
| 52 | } |
||
| 53 |