Passed
Pull Request — development (#671)
by Nick
06:47
created

CreateWebCacheCommand::execute()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 19
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 10
nc 1
nop 2
dl 0
loc 19
rs 9.4285
c 0
b 0
f 0
1
<?php
2
/***************************************************************************
3
 * for license information see LICENSE.md
4
 ***************************************************************************/
5
6
namespace Oc\Command;
7
8
use Leafo\ScssPhp\Compiler;
9
use Symfony\Component\Console\Exception\InvalidArgumentException;
10
use Symfony\Component\Console\Input\InputInterface;
11
use Symfony\Component\Console\Output\OutputInterface;
12
13
/**
14
 * Class CreateWebCacheCommand
15
 *
16
 * @package Oc\Command
17
 */
18
class CreateWebCacheCommand extends AbstractCommand
19
{
20
    const COMMAND_NAME = 'cache:web:create';
21
22
    /**
23
     * Configures the command.
24
     *
25
     * @return void
26
     *
27
     * @throws InvalidArgumentException
28
     */
29
    protected function configure()
30
    {
31
        parent::configure();
32
33
        $this
34
            ->setName(self::COMMAND_NAME)
35
            ->setDescription('create legacy web caches');
36
    }
37
38
    /**
39
     * Executes the command.
40
     *
41
     * @param InputInterface $input
42
     * @param OutputInterface $output
43
     *
44
     * @return int|null
45
     */
46
    protected function execute(InputInterface $input, OutputInterface $output)
47
    {
48
        $output->writeln('generate style.css');
49
50
        $scss = new Compiler();
51
        $scss->setImportPaths(
52
            [
53
                __DIR__ . '/../../../vendor/twbs/bootstrap/scss/',
54
                __DIR__ . '/../../../theme/scss/',
55
            ]
56
        );
57
58
        file_put_contents(
59
            __DIR__ . '/../../../web/css/style.css',
60
            $scss->compile('@import "all.scss";')
61
        );
62
63
        $output->writeln('style.css generated');
64
    }
65
}
66