Completed
Push — master ( 061748...863025 )
by Vincenzo
02:39
created

CreateModelCommand   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 4
c 1
b 0
f 1
lcom 0
cbo 2
dl 0
loc 29
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getFileName() 0 4 1
A getHead() 0 6 1
A getFilePath() 0 4 1
A getStub() 0 6 1
1
<?php
2
3
4
namespace App\Lib\Slime\Console\Commands;
5
6
7
use App\Lib\Helpers\TextFormatter;
8
use App\Lib\Slime\Console\GeneratorHelperCommand;
9
10
class CreateModelCommand extends GeneratorHelperCommand
11
{
12
    protected function getFileName()
13
    {
14
        return TextFormatter::snakeToCamelCase($this->getArg(0));
15
    }
16
17
18
    protected function getHead()
19
    {
20
        $fileHead = parent::getHead();
21
        $fileHead .= PHP_EOL . 'namespace App\Models;' . PHP_EOL . 'use App\Lib\Slime\Models\SlimeModel;' . PHP_EOL;
22
        return $fileHead;
23
    }
24
25
    protected function getFilePath()
26
    {
27
        return 'Models/';
28
    }
29
30
    protected function getStub()
31
    {
32
        return PHP_EOL . 'class ' .
33
        TextFormatter::snakeToCamelCase($this->getArg(0)) .
34
        ' extends SlimeModel {' . PHP_EOL . '}';
35
    }
36
37
38
}