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

RequestInput::__construct()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 14

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 3.0175

Importance

Changes 0
Metric Value
dl 0
loc 14
ccs 7
cts 8
cp 0.875
rs 9.7998
c 0
b 0
f 0
cc 3
nc 3
nop 2
crap 3.0175
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