Passed
Push — master ( 2ab272...5c38aa )
by Rougin
02:42
created

InstallWildfireCommand::execute()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 15
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1.2963

Importance

Changes 0
Metric Value
cc 1
eloc 8
nc 1
nop 2
dl 0
loc 15
ccs 3
cts 9
cp 0.3333
crap 1.2963
rs 10
c 0
b 0
f 0
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
use Rougin\Combustor\Common\File;
9
use Rougin\Combustor\Common\Tools;
10
use Rougin\Combustor\Common\Commands\InstallCommand;
11
12
/**
13
 * Install Wildfire Command
14
 *
15
 * Installs Wildfire for CodeIgniter
16
 *
17
 * @package Combustor
18
 * @author  Rougin Gutib <[email protected]>
19
 */
20
class InstallWildfireCommand extends InstallCommand
21
{
22
    /**
23
     * @var string
24
     */
25
    protected $library = 'wildfire';
26
27
    /**
28
     * Executes the command.
29
     *
30
     * @param  \Symfony\Component\Console\Input\InputInterface   $input
31
     * @param  \Symfony\Component\Console\Output\OutputInterface $output
32
     * @return object|\Symfony\Component\Console\Output\OutputInterface
33
     */
34 3
    protected function execute(InputInterface $input, OutputInterface $output)
35
    {
36 3
        $this->addLibrary('wildfire');
37
38 3
        $template = $this->renderer->render('Libraries/Wildfire.tpl');
39
        $wildfire = new File(APPPATH . 'libraries/Wildfire.php');
40
41
        $wildfire->putContents($template);
42
        $wildfire->close();
43
44
        Tools::ignite();
45
46
        $message = 'Wildfire is now installed successfully!';
47
48
        return $output->writeln('<info>' . $message . '</info>');
49
    }
50
}
51