Generate   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 13 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 Generate extends Command
16
{
17
    public function __invoke($type, $classname = null)
18
    {
19
        $generator = __NAMESPACE__ . '\\Generate\\' . ucfirst($type);
20
        if (! class_exists($generator)) {
21
            $this->stdio->errln(
22
                '<<red>>No such generator class: ' . $generator . '<<reset>>'
23
            );
24
            return Status::FAILURE;
25
        }
26
27
        $command = new $generator($this->context, $this->stdio, $this->ci);
28
        return $command($type, $classname);
29
    }
30
}
31