Test Failed
Push — master ( 54db62...a5394f )
by Terzi
06:48
created

SettingsMakeCommand::handle()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
cc 2
eloc 3
nc 2
nop 0
dl 0
loc 7
ccs 0
cts 1
cp 0
crap 6
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Terranet\Administrator\Console;
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
7
class SettingsMakeCommand extends GeneratorCommand
8
{
9
    /**
10
     * The console command name.
11
     *
12
     * @var string
13
     */
14
    protected $name = 'administrator:resource:settings';
15
16
    /**
17
     * The console command description.
18
     *
19
     * @var string
20
     */
21
    protected $description = 'Create new administrator settings resource [Requires terranet/options package.';
22
23
    /**
24
     * The type of class being generated.
25
     *
26
     * @var string
27
     */
28
    protected $type = 'Resource';
29
30
    /**
31
     * Execute the console command.
32
     *
33
     * @return bool|null
34
     * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
35
     */
36
    public function handle()
37
    {
38
        if (!class_exists(\Terranet\Options\Manager::class, true)) {
0 ignored issues
show
Bug introduced by
The type Terranet\Options\Manager 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...
39
            $this->alert("Dependency missing. Run 'composer require adminarchitect/options'.");
40
        }
41
42
        parent::handle();
43
    }
44
45
    /**
46
     * Get the stub file for the generator.
47
     *
48
     * @return string
49
     */
50
    protected function getStub()
51
    {
52
        return __DIR__.'/stubs/module.settings.stub';
53
    }
54
55
    /**
56
     * Get the default namespace for the class.
57
     *
58
     * @param string $rootNamespace
59
     *
60
     * @return string
61
     */
62
    protected function getDefaultNamespace($rootNamespace)
63
    {
64
        return $rootNamespace.'\\'.config('administrator.paths.module');
0 ignored issues
show
Bug introduced by
The function config was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

64
        return $rootNamespace.'\\'./** @scrutinizer ignore-call */ config('administrator.paths.module');
Loading history...
65
    }
66
67
    protected function getArguments()
68
    {
69
        return [];
70
    }
71
72
    protected function getNameInput()
73
    {
74
        return 'Settings';
75
    }
76
}
77