| Total Complexity | 11 |
| Total Lines | 58 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 8 | class SpacelessFormatter implements SitemapIndexFormatterInterface |
||
| 9 | { |
||
| 10 | protected $formatter; |
||
| 11 | |||
| 12 | public function __construct(FormatterInterface $formatter) |
||
| 13 | { |
||
| 14 | $this->formatter = $formatter; |
||
| 15 | } |
||
| 16 | |||
| 17 | public function getSitemapStart() |
||
| 18 | { |
||
| 19 | return $this->stripSpaces($this->formatter->getSitemapStart()); |
||
| 20 | } |
||
| 21 | |||
| 22 | public function getSitemapEnd() |
||
| 23 | { |
||
| 24 | return $this->stripSpaces($this->formatter->getSitemapEnd()); |
||
| 25 | } |
||
| 26 | |||
| 27 | public function formatUrl(Url $url) |
||
| 28 | { |
||
| 29 | return $this->stripSpaces($this->formatter->formatUrl($url)); |
||
| 30 | } |
||
| 31 | |||
| 32 | public function getSitemapIndexStart() |
||
| 33 | { |
||
| 34 | if (!$this->formatter instanceof SitemapIndexFormatterInterface) { |
||
| 35 | return ''; |
||
| 36 | } |
||
| 37 | |||
| 38 | return $this->stripSpaces($this->formatter->getSitemapIndexStart()); |
||
| 39 | } |
||
| 40 | |||
| 41 | public function getSitemapIndexEnd() |
||
| 42 | { |
||
| 43 | if (!$this->formatter instanceof SitemapIndexFormatterInterface) { |
||
| 44 | return ''; |
||
| 45 | } |
||
| 46 | |||
| 47 | return $this->stripSpaces($this->formatter->getSitemapIndexEnd()); |
||
| 48 | } |
||
| 49 | |||
| 50 | public function formatSitemapIndex(SitemapIndex $sitemapIndex) |
||
| 57 | } |
||
| 58 | |||
| 59 | protected function stripSpaces($string) |
||
| 60 | { |
||
| 61 | return str_replace([ |
||
| 62 | "\t", |
||
| 63 | "\r", |
||
| 66 | } |
||
| 67 | } |