Passed
Push — master ( 4e0c2f...af0465 )
by Prateek
04:42 queued 02:26
created

Controller::generate()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 11
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
namespace Prateekkarki\Laragen\Generators\Backend;
3
4
use Prateekkarki\Laragen\Generators\BaseGenerator;
5
use Prateekkarki\Laragen\Generators\GeneratorInterface;
6
7
class Controller extends BaseGenerator implements GeneratorInterface
8
{
9
    public function generate()
10
    {
11
        $controllerTemplate = $this->buildTemplate('Backend/Controller', [
12
            '{{modelName}}'                  => $this->module->getModelName(),
13
            '{{moduleName}}'                 => $this->module->getModuleName(),
14
            '{{modelNameLowercase}}' => strtolower($this->module->getModelName())
15
        ]);
16
        
17
        $fullFilePath = $this->getPath("app/Http/Controllers/Backend/").$this->module->getModelName()."Controller".".php";
18
        file_put_contents($fullFilePath, $controllerTemplate);
19
        return $fullFilePath;
20
    }
21
}
22