BuildWebsiteCommand::execute()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 7
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
crap 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