InstallWildfireCommand::execute()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 15
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 9
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 8
c 0
b 0
f 0
nc 1
nop 2
dl 0
loc 15
ccs 9
cts 9
cp 1
crap 1
rs 10
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 18
    protected function execute(InputInterface $input, OutputInterface $output)
35
    {
36 18
        $this->addLibrary('wildfire');
37
38 18
        $template = $this->renderer->render('Libraries/Wildfire.tpl');
39 18
        $wildfire = new File(APPPATH . 'libraries/Wildfire.php');
0 ignored issues
show
Bug introduced by
The constant Rougin\Combustor\Commands\APPPATH was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
40
41 18
        $wildfire->putContents($template);
42 18
        $wildfire->close();
43
44 18
        Tools::ignite();
45
46 18
        $message = 'Wildfire is now installed successfully!';
47
48 18
        return $output->writeln('<info>' . $message . '</info>');
49
    }
50
}
51