BuildWebsiteCommand   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
eloc 13
dl 0
loc 36
ccs 13
cts 13
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 0 4 1
A execute() 0 7 1
A __construct() 0 10 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Doctrine\Bundle\DoctrineStaticWebsiteGeneratorBundle\Command;
6
7
use Doctrine\StaticWebsiteGenerator\SourceFile\SourceFileRepository;
8
use Doctrine\StaticWebsiteGenerator\SourceFile\SourceFilesBuilder;
9
use Symfony\Component\Console\Command\Command;
10
use Symfony\Component\Console\Input\InputInterface;
11
use Symfony\Component\Console\Output\OutputInterface;
12
13
class BuildWebsiteCommand extends Command
14
{
15
    /** @var SourceFileRepository */
16
    private $sourceFileRepository;
17
18
    /** @var SourceFilesBuilder */
19
    private $sourceFilesBuilder;
20
21
    /** @var string */
22
    private $buildDir;
23
24 3
    public function __construct(
25
        SourceFileRepository $sourceFileRepository,
26
        SourceFilesBuilder $sourceFilesBuilder,
27
        string $buildDir
28
    ) {
29 3
        parent::__construct();
30
31 3
        $this->sourceFileRepository = $sourceFileRepository;
32 3
        $this->sourceFilesBuilder   = $sourceFilesBuilder;
33 3
        $this->buildDir             = $buildDir;
34 3
    }
35
36 3
    protected function configure() : void
37
    {
38
        $this
39 3
            ->setName('doctrine:build-website');
40 3
    }
41
42 2
    protected function execute(InputInterface $input, OutputInterface $output) : int
43
    {
44 2
        $sourceFiles = $this->sourceFileRepository->getSourceFiles($this->buildDir);
45
46 2
        $this->sourceFilesBuilder->buildSourceFiles($sourceFiles);
47
48 2
        return 0;
49
    }
50
}
51