InstallWildfireCommand   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 10
c 0
b 0
f 0
dl 0
loc 29
ccs 9
cts 9
cp 1
rs 10
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 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