Completed
Pull Request — master (#1088)
by
unknown
02:55
created

ModuleCommandArguments   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 28
ccs 0
cts 12
cp 0
rs 10
c 0
b 0
f 0
wmc 2
lcom 1
cbo 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getArguments() 0 6 1
A getOptions() 0 6 1
1
<?php
2
3
namespace Nwidart\Modules\Console\Traits;
4
5
use Symfony\Component\Console\Input\InputOption;
6
use Symfony\Component\Console\Input\InputArgument;
7
use Nwidart\Modules\Console\Traits\CommandArguments;
8
9
trait ModuleCommandArguments
10
{
11
    use CommandArguments;
12
13
    /**
14
     * Get console command arguments.
15
     *
16
     * @return array
17
     */
18
    protected function getArguments()
19
    {
20
        return array_merge($this->setArguments(), [
21
            [$this->argumentName, InputArgument::REQUIRED, 'The name of the resource.']
0 ignored issues
show
Bug introduced by
The property argumentName does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
22
        ]);
23
    }
24
25
    /**
26
     * Get console command arguments.
27
     *
28
     * @return array
29
     */
30
    protected function getOptions()
31
    {
32
        return array_merge($this->setOptions(), [
33
            ['force', 'f', InputOption::VALUE_NONE, 'Force the operation to run when files already exists.']
34
        ]);
35
    }
36
}
37