Completed
Push — master ( ab8175...d69783 )
by Kamil
15s
created

FixturesLoadCommand::getSuiteLoader()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of the Sylius package.
5
 *
6
 * (c) Paweł Jędrzejewski
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Sylius\Bundle\FixturesBundle\Command;
13
14
use Sylius\Bundle\FixturesBundle\Loader\SuiteLoaderInterface;
15
use Sylius\Bundle\FixturesBundle\Suite\SuiteRegistryInterface;
16
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
17
use Symfony\Component\Console\Input\InputArgument;
18
use Symfony\Component\Console\Input\InputInterface;
19
use Symfony\Component\Console\Output\OutputInterface;
20
21
/**
22
 * @author Kamil Kokot <[email protected]>
23
 */
24
final class FixturesLoadCommand extends ContainerAwareCommand
25
{
26
    /**
27
     * {@inheritdoc}
28
     */
29
    protected function configure()
30
    {
31
        $this
32
            ->setName('sylius:fixtures:load')
33
            ->setDescription('Loads fixtures from given suite')
34
            ->addArgument('suite', InputArgument::REQUIRED, 'Suite name')
35
        ;
36
    }
37
38
    /**
39
     * {@inheritdoc}
40
     */
41
    protected function execute(InputInterface $input, OutputInterface $output)
42
    {
43
        $suiteName = $input->getArgument('suite');
44
45
        $suite = $this->getSuiteRegistry()->getSuite($suiteName);
46
47
        $this->getSuiteLoader()->load($suite);
48
    }
49
50
    /**
51
     * @return SuiteRegistryInterface
52
     */
53
    private function getSuiteRegistry()
54
    {
55
        return $this->getContainer()->get('sylius_fixtures.suite_registry');
56
    }
57
58
    /**
59
     * @return SuiteLoaderInterface
60
     */
61
    private function getSuiteLoader()
62
    {
63
        return $this->getContainer()->get('sylius_fixtures.suite_loader');
64
    }
65
}
66