Passed
Push — develop ( a0544e...04fdb9 )
by Brent
02:25
created

RenderSiteMap   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 21
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0
wmc 2
lcom 1
cbo 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A execute() 0 6 1
1
<?php
2
3
namespace Stitcher\Task;
4
5
use Pageon\Html\SiteMap;
6
use Stitcher\Task;
7
8
class RenderSiteMap implements Task
9
{
10
    /** @var string */
11
    private $publicDirectory;
12
13
    /** @var \Pageon\Html\SiteMap */
14
    private $siteMap;
15
16 5
    public function __construct(string $publicDirectory, SiteMap $siteMap)
17
    {
18 5
        $this->publicDirectory = $publicDirectory;
19 5
        $this->siteMap = $siteMap;
20 5
    }
21
22 3
    public function execute(): void
23
    {
24 3
        $siteMap = $this->siteMap->render();
25
26 3
        file_put_contents($this->publicDirectory . '/sitemap.xml', $siteMap);
27 3
    }
28
}
29