Completed
Push — master ( f2b8b4...a21374 )
by Tom
24s queued 11s
created

RequestInput   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 87.5%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 2
dl 0
loc 20
ccs 7
cts 8
cp 0.875
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 14 3
1
<?php
2
3
declare(strict_types=1);
4
5
namespace DoctrineModule\Component\Console\Input;
6
7
use Laminas\Console\Request;
8
use Symfony\Component\Console\Input\ArgvInput;
9
use Symfony\Component\Console\Input\InputDefinition;
10
use function is_numeric;
11
12
/**
13
 * RequestInput represents an input provided as an console request.
14
 */
15
class RequestInput extends ArgvInput
16
{
17
    /**
18
     * Constructor
19
     */
20 1
    public function __construct(Request $request, ?InputDefinition $definition = null)
21
    {
22 1
        $parameters = [null];
23
24 1
        foreach ($request->getParams() as $key => $param) {
25 1
            if (! is_numeric($key)) {
26
                continue;
27
            }
28
29 1
            $parameters[] = $param;
30
        }
31
32 1
        parent::__construct($parameters, $definition);
33 1
    }
34
}
35