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

MakeQueryFiltersCommand::getDefaultNamespace()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 4
nc 2
nop 1
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