InstallDependenciesStep   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
c 0
b 0
f 0
lcom 0
cbo 1
dl 0
loc 27
ccs 6
cts 6
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 2
A __invoke() 0 6 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Zalas\Symfify\Composer\SymfifyStep;
6
7
use Symfony\Component\Console\Output\OutputInterface;
8
use Zalas\Symfify\Composer\SymfifyStep;
9
10
class InstallDependenciesStep implements SymfifyStep
11
{
12
    /**
13
     * @var array
14
     */
15
    private $dependencies = [
16
        'symfony/framework-bundle',
17
    ];
18
19
    /**
20
     * @var OutputInterface
21
     */
22
    private $output;
23
24 4
    public function __construct(OutputInterface $output, array $dependencies = [])
25
    {
26 4
        $this->output = $output;
27 4
        $this->dependencies = $dependencies ?: $this->dependencies;
28
    }
29
30 2
    public function __invoke()
31
    {
32 2
        $this->output->writeln(\sprintf('Installing <comment>%s</comment>', \implode('</comment>, <comment>', $this->dependencies)));
33
34 2
        \system(\sprintf('composer require -q %s', \implode(' ', \array_map('escapeshellarg', $this->dependencies))));
35
    }
36
}
37