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

InstallWildfireCommand   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Test Coverage

Coverage 33.33%

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 29
ccs 3
cts 9
cp 0.3333
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A execute() 0 15 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
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