CriteriaMakeCommand::replaceClass()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 2
c 1
b 0
f 1
nc 1
nop 2
dl 0
loc 5
rs 10
1
<?php
2
3
namespace Blok\Repository\Commands;
4
5
use Illuminate\Console\GeneratorCommand;
0 ignored issues
show
Bug introduced by
The type Illuminate\Console\GeneratorCommand was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
use Symfony\Component\Console\Input\InputArgument;
0 ignored issues
show
Bug introduced by
The type Symfony\Component\Console\Input\InputArgument was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
7
8
class CriteriaMakeCommand extends GeneratorCommand
9
{
10
    /**
11
     * The console command name.
12
     *
13
     * @var string
14
     */
15
    protected $name = 'make:criteria';
16
17
    /**
18
     * The console command description.
19
     *
20
     * @var string
21
     */
22
    protected $description = 'Create a new criteria class';
23
24
    /**
25
     * The type of class being generated.
26
     *
27
     * @var string
28
     */
29
    protected $type = 'Criteria';
30
31
    /**
32
     * Get the stub file for the generator.
33
     *
34
     * @return string
35
     */
36
    protected function getStub()
37
    {
38
        return __DIR__.'/stubs/criteria.stub';
39
    }
40
41
    /**
42
     * Replace the class name for the given stub.
43
     *
44
     * @param  string  $stub
45
     * @param  string  $name
46
     * @return string
47
     */
48
    protected function replaceClass($stub, $name)
49
    {
50
        $class = str_replace($this->getNamespace($name).'\\', '', $name);
51
52
        return str_replace(['DummyClass'], [$class], $stub);
53
    }
54
55
    /**
56
     * Get the default namespace for the class.
57
     *
58
     * @param  string  $rootNamespace
59
     * @return string
60
     */
61
    protected function getDefaultNamespace($rootNamespace)
62
    {
63
        return $rootNamespace.'\Repositories\Criterias';
64
    }
65
66
    /**
67
     * Get the console command arguments.
68
     *
69
     * @return array
70
     */
71
    protected function getArguments()
72
    {
73
        return [
74
            [
75
                'name', InputArgument::REQUIRED, 'The name of the Criteria'
76
            ],
77
        ];
78
    }
79
}
80