BuildCommand   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
eloc 10
dl 0
loc 24
ccs 0
cts 5
cp 0
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A execute() 0 7 1
A __construct() 0 5 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Fabiang\AsseticBundle\Cli;
6
7
use Fabiang\AsseticBundle\Service;
8
use Symfony\Component\Console\Command\Command;
9
use Symfony\Component\Console\Input\InputInterface;
10
use Symfony\Component\Console\Output\OutputInterface;
11
12
class BuildCommand extends Command
13
{
14
    /**
15
     * The assetic service
16
     */
17
    private Service $assetic;
18
19
    public function __construct(Service $assetic)
20
    {
21
        parent::__construct('build');
22
        $this->assetic = $assetic;
23
        $this->setDescription('Build all assets.');
24
    }
25
26
    /**
27
     * Executes the current command.
28
     */
29
    protected function execute(InputInterface $input, OutputInterface $output): int
30
    {
31
        $config = $this->assetic->getConfiguration();
32
        $config->setBuildOnRequest(true);
33
        $this->assetic->build();
34
        $this->assetic->getAssetWriter()->writeManagerAssets($this->assetic->getAssetManager());
35
        return 0;
36
    }
37
}
38