Completed
Push — master ( 304836...019818 )
by Andrea Marco
07:40
created

MakeQueryFiltersCommand   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 1
dl 0
loc 48
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getStub() 0 4 1
A getDefaultNamespace() 0 8 2
1
<?php
2
3
namespace Cerbero\QueryFilters;
4
5
use Illuminate\Console\GeneratorCommand;
6
7
/**
8
 * Artisan command to create query filters.
9
 *
10
 * @author    Andrea Marco Sartori
11
 */
12
class MakeQueryFiltersCommand extends GeneratorCommand
13
{
14
    /**
15
     * The console command name.
16
     *
17
     * @var string
18
     */
19
    protected $name = 'make:query-filters';
20
21
    /**
22
     * The console command description.
23
     *
24
     * @var string
25
     */
26
    protected $description = 'Create a new query filters class';
27
28
    /**
29
     * The type of class being generated.
30
     *
31
     * @var string
32
     */
33
    protected $type = 'Query filters';
34
35
    /**
36
     * Get the stub file for the generator.
37
     *
38
     * @return string
39
     */
40
    protected function getStub()
41
    {
42
        return __DIR__.'/query_filters.stub';
43
    }
44
45
    /**
46
     * Get the default namespace for the class.
47
     *
48
     * @param  string  $rootNamespace
49
     * @return string
50
     */
51
    protected function getDefaultNamespace($rootNamespace)
52
    {
53
        if ($path = config('query_filters.path')) {
54
            return $rootNamespace . '\\' . str_replace('/', '\\', $path);
55
        }
56
57
        return $rootNamespace;
58
    }
59
}
60