Parser   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A getCommandAndArguments() 0 13 2
1
<?php
2
3
namespace Buttress\Concrete\Console\Command\Argument;
4
5
class Parser extends \League\CLImate\Argument\Parser
6
{
7
8
    /**
9
     * Pull a command name and arguments from $argv.
10
     *
11
     * @param array $argv
12
     * @return array
13
     */
14 6
    protected function getCommandAndArguments(array $argv = null)
15
    {
16
        // If no $argv is provided then use the global PHP defined $argv.
17 6
        if (is_null($argv)) {
18 3
            global $argv;
0 ignored issues
show
Compatibility Best Practice introduced by
Use of global functionality is not recommended; it makes your code harder to test, and less reusable.

Instead of relying on global state, we recommend one of these alternatives:

1. Pass all data via parameters

function myFunction($a, $b) {
    // Do something
}

2. Create a class that maintains your state

class MyClass {
    private $a;
    private $b;

    public function __construct($a, $b) {
        $this->a = $a;
        $this->b = $b;
    }

    public function myFunction() {
        // Do something
    }
}
Loading history...
19 2
        }
20
21 6
        $arguments = $argv;
22 6
        $script    = array_shift($arguments);
23 6
        $command   = array_shift($arguments);
24
25 6
        return compact('arguments', 'script', 'command');
26
    }
27
}
28