Completed
Push — master ( d8474d...556100 )
by Rougin
05:42
created

AbstractCommand::isEnabled()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 6
ccs 3
cts 3
cp 1
rs 9.4285
cc 1
eloc 3
nc 1
nop 0
crap 1
1
<?php
2
3
namespace Rougin\Refinery\Commands;
4
5
use CI_Controller;
6
use Twig_Environment;
7
use Symfony\Component\Console\Command\Command;
8
9
use Rougin\Describe\Describe;
10
11
/**
12
 * Abstract Command
13
 *
14
 * Extends the Symfony\Console\Command class with Twig's renderer,
15
 * CodeIgniter's instance and Describe.
16
 * 
17
 * @package Refinery
18
 * @author  Rougin Royce Gutib <[email protected]>
19
 */
20
abstract class AbstractCommand extends Command
21
{
22
    /**
23
     * @var \Rougin\Describe\Describe
24
     */
25
    protected $describe;
26
27
    /**
28
     * @var \Twig_Environment
29
     */
30
    protected $renderer;
31
32
    /**
33
     * @var \CI_Controller
34
     */
35
    protected $codeigniter;
36
37
    /**
38
     * @param \CI_Controller            $controller
0 ignored issues
show
Bug introduced by
There is no parameter named $controller. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
39
     * @param \Rougin\Describe\Describe $describe
40
     * @param \Twig_Environment         $renderer
41
     */
42 33
    public function __construct(CI_Controller $codeigniter, Describe $describe, Twig_Environment $renderer)
43
    {
44 33
        parent::__construct();
45
46 33
        $this->codeigniter = $codeigniter;
47 33
        $this->describe = $describe;
48 33
        $this->renderer = $renderer;
49 33
    }
50
51
    /**
52
     * Checks whether the command is enabled or not in the current environment.
53
     *
54
     * @return bool
55
     */
56 3
    public function isEnabled()
57
    {
58 3
        $migrations = glob(APPPATH . 'migrations/*.php');
59
60 3
        return count($migrations) > 0;
61
    }
62
}
63