Run   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 0
Metric Value
dl 0
loc 24
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 4

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 21 2
1
<?php
2
/**
3
 * Part of Cli for CodeIgniter
4
 *
5
 * @author     Kenji Suzuki <https://github.com/kenjis>
6
 * @license    MIT License
7
 * @copyright  2015 Kenji Suzuki
8
 * @link       https://github.com/kenjis/codeigniter-cli
9
 */
10
11
namespace Kenjis\CodeIgniter_Cli\Command;
12
13
use Aura\Cli\Status;
14
15
class Run extends Command
16
{
17
    public function __invoke($controller = null, $method = null)
18
    {
19
        if ($controller === null) {
20
            $this->stdio->errln('<<red>>Controller is needed<<reset>>');
21
            return Status::USAGE;
22
        }
23
24
        $argv = $this->context->argv->get();
25
        array_shift($argv);
26
        array_shift($argv);
27
        array_shift($argv);
28
        array_shift($argv);
29
        $arguments = implode(' ', $argv);
30
31
        $console = FCPATH . 'index.php';
32
        $this->stdio->outln(
33
            "<<green>>php {$console} {$controller} {$method} {$arguments}<<reset>>"
34
        );
35
        passthru("php {$console} {$controller} {$method}  {$arguments}");
36
        $this->stdio->outln('');
37
    }
38
}
39