Completed
Push — master ( b9481e...fee819 )
by Prateek
04:31 queued 02:08
created

Generate   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 12
dl 0
loc 35
rs 10
c 0
b 0
f 0
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 14 3
1
<?php
2
3
namespace Prateekkarki\Laragen\Commands;
4
5
use Illuminate\Console\Command;
6
use Prateekkarki\Laragen\Models\Module;
7
8
class Generate extends Command
9
{
10
    /**
11
     * The name and signature of the console command.
12
     *
13
     * @var string
14
     */
15
    protected $signature = 'laragen:make';
16
17
    /**
18
     * The console command description.
19
     *
20
     * @var string
21
     */
22
    protected $description = 'Generate code for your project';
23
24
    /**
25
     * Execute the console command.
26
     *
27
     * @return mixed
28
     */
29
    public function handle()
30
    {
31
        $config = config('laragen');
32
        foreach ($config['modules'] as $moduleName => $moduleArray) {
33
            $moduleArray['name'] = $moduleName;
34
            $module = new Module($moduleArray);
35
36
            // ToDo: to be loaded dynamically
37
            $itemsToGenerate = ['Migration', 'Controller', 'Model'];
38
39
            foreach ($itemsToGenerate as $item) {
40
                $generator = "\\Prateekkarki\\Laragen\\Generators\\{$item}";
41
                $itemGenerator = new $generator($module);
42
                $itemGenerator->generate();
43
            }
44
        }
45
    }
46
}
47