Completed
Pull Request — master (#17)
by Rougin
11:45
created

MakeLayoutCommand::execute()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 10
ccs 7
cts 7
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 6
nc 1
nop 2
crap 1
1
<?php
2
3
namespace Rougin\Combustor\Commands;
4
5
use Symfony\Component\Console\Input\InputInterface;
6
use Symfony\Component\Console\Output\OutputInterface;
7
8
/**
9
 * Make Layout Command
10
 *
11
 * @package Combustor
12
 * @author  Rougin Royce Gutib <[email protected]>
13
 */
14
class MakeLayoutCommand extends AbstractCommand
15
{
16
    /**
17
     * Set the configurations of the specified command.
18
     *
19
     * @return void
20
     */
21 6
    protected function configure()
22
    {
23 6
        $this->setName('make:layout')->setDescription('Create a new view layout');
24 6
    }
25
26
    /**
27
     * Executes the current command.
28
     *
29
     * @param  \Symfony\Component\Console\Input\InputInterface  $input
30
     * @param  \Symfony\Component\Console\Input\OutputInterface $output
31
     * @return void
32
     */
33 3
    protected function execute(InputInterface $input, OutputInterface $output)
34
    {
35 3
        $header = $this->renderer->render('Views/Layout/Header.twig');
36 3
        $footer = $this->renderer->render('Views/Layout/Footer.twig');
37
38 3
        $this->filesystem->write('application/views/layout/header.php', $header);
39 3
        $this->filesystem->write('application/views/layout/footer.php', $footer);
40
41 3
        $output->writeln('<info>Layout created successfully!</info>');
42 3
    }
43
}
44