Command::__construct()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 4
nc 2
nop 2
dl 0
loc 6
ccs 4
cts 4
cp 1
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Conia\Quma\Commands;
6
7
use Conia\Cli\Command as BaseCommand;
8
use Conia\Quma\Connection;
9
use Conia\Quma\Environment;
10
11
abstract class Command extends BaseCommand
12
{
13
    protected readonly Environment $env;
14
15
    /** @psalm-param array<non-empty-string, Connection>|Connection $conn */
16 39
    public function __construct(array|Connection $conn, array $options = [])
17
    {
18 39
        if (is_array($conn)) {
0 ignored issues
show
introduced by
The condition is_array($conn) is always true.
Loading history...
19 5
            $this->env = new Environment($conn, $options);
20
        } else {
21 34
            $this->env = new Environment(['default' => $conn], $options);
22
        }
23
    }
24
}
25