Completed
Pull Request — master (#26)
by Emanuele
03:28
created

LegacyLoadFeatureCommand::configure()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 17
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 17
rs 9.4285
cc 1
eloc 13
nc 1
nop 0
1
<?php
2
3
namespace Ae\FeatureBundle\Command;
4
5
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
6
use Symfony\Component\Console\Input\ArrayInput;
7
use Symfony\Component\Console\Input\InputArgument;
8
use Symfony\Component\Console\Input\InputInterface;
9
use Symfony\Component\Console\Input\InputOption;
10
use Symfony\Component\Console\Output\OutputInterface;
11
use Symfony\Component\Console\Style\SymfonyStyle;
12
13
/**
14
 * @author Carlo Forghieri <[email protected]>
15
 *
16
 * @deprecated The "features:load" command is deprecated since 1.2 and will be removed in 2.0. Use "adespresso:features:load" instead.
17
 */
18
class LegacyLoadFeatureCommand extends ContainerAwareCommand
19
{
20
    /**
21
     * {@inheritdoc}
22
     */
23
    protected function configure()
24
    {
25
        $this
26
            ->setName('features:load')
27
            ->setDescription('Persist new features found in templates (deprecated)')
28
            ->addArgument(
29
                'bundle',
30
                InputArgument::REQUIRED,
31
                'The bundle where to load the features'
32
            )
33
            ->addOption(
34
                'dry-run',
35
                null,
36
                InputOption::VALUE_NONE,
37
                'Do not persist new features'
38
            );
39
    }
40
41
    /**
42
     * {@inheritdoc}
43
     */
44
    public function execute(InputInterface $input, OutputInterface $output)
45
    {
46
        $style = new SymfonyStyle($input, $output);
47
        $style->caution('The "features:load" command is deprecated since 1.2 and will be removed in 2.0. Use "adespresso:features:load" instead.');
48
49
        $application = $this->getApplication();
50
        $path = $application
51
            ->getKernel()
52
            ->getBundle($input->getArgument('bundle'))
53
            ->getPath();
54
55
        $path .= '/Resources/views/';
56
57
        $commandInput = new ArrayInput([
58
            'command' => 'adespresso:features:load',
59
            'path' => [
60
                $path,
61
            ],
62
            '--dry-run' => $input->getOption('dry-run'),
63
        ]);
64
65
        return $application
66
            ->find('adespresso:features:load')
67
            ->run($commandInput, $output);
68
    }
69
}
70