SymfifyCommand   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 7

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 2
c 2
b 0
f 0
lcom 1
cbo 7
dl 0
loc 28
ccs 13
cts 13
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 0 6 1
A execute() 0 16 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Zalas\Symfify\Composer;
6
7
use Composer\Command\BaseCommand;
8
use Symfony\Component\Console\Input\InputArgument;
9
use Symfony\Component\Console\Input\InputInterface;
10
use Symfony\Component\Console\Output\OutputInterface;
11
use Zalas\Symfify\Composer\SymfifyStep\ChangeWorkingDirectoryStep;
12
use Zalas\Symfify\Composer\SymfifyStep\CreateDirectoriesStep;
13
use Zalas\Symfify\Composer\SymfifyStep\CreateFilesStep;
14
use Zalas\Symfify\Composer\SymfifyStep\InstallDependenciesStep;
15
16
class SymfifyCommand extends BaseCommand
17
{
18
    const VERSION = '1.0.0-dev';
19
20 5
    protected function configure()
21
    {
22 5
        $this->setName('symfify');
23 5
        $this->addArgument('path', InputArgument::REQUIRED, 'Path to symfify');
24 5
        $this->setDescription('Sets up a basic Symfony project in a code base that did not start as a Symfony project.');
25
    }
26
27 2
    protected function execute(InputInterface $input, OutputInterface $output)
28
    {
29 2
        $output->writeln(\sprintf('<info>Symfify</info> version <comment>%s</comment>', self::VERSION));
30 2
        $output->writeln('');
31
32
        $steps = [
33 2
            new ChangeWorkingDirectoryStep($input->getArgument('path')),
34 2
            new InstallDependenciesStep($output),
35 2
            new CreateDirectoriesStep($output),
36 2
            new CreateFilesStep($output),
37
        ];
38
39
        \array_walk($steps, function (SymfifyStep $step) {
40 2
            $step();
41 2
        });
42
    }
43
}
44