Passed
Push — ft/sitemap ( 686bce...8c914b )
by Ben
07:09
created

SitemapXmlFile   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 6
c 1
b 0
f 0
dl 0
loc 15
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A create() 0 5 1
A __construct() 0 3 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Thinktomorrow\Chief\System\Sitemap;
5
6
class SitemapXmlFile
7
{
8
    /** @var SitemapXml */
9
    private $sitemapXml;
10
11
    public function __construct(SitemapXml $sitemapXml)
12
    {
13
        $this->sitemapXml = $sitemapXml;
14
    }
15
16
    public function create(string $locale, string $filepath): void
17
    {
18
        $xmlString = $this->sitemapXml->generate($locale);
19
trap($xmlString);
20
        file_put_contents($filepath, $xmlString);
21
    }
22
}
23