Passed
Pull Request — master (#354)
by Mihai
07:14
created

PhiveInstallCommand::__toString()   A

Complexity

Conditions 3
Paths 1

Size

Total Lines 8
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 3
eloc 6
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 8
ccs 7
cts 7
cp 1
crap 3
rs 10
1
<?php declare(strict_types=1);
2
3
namespace Zalas\Toolbox\Tool\Command;
4
5
use Zalas\Toolbox\Tool\Command;
6
7
final class PhiveInstallCommand implements Command
8
{
9
    private $alias;
10
    private $bin;
11
    private $trust;
12
    private $unsigned;
13
14 10
    public function __construct(string $alias, string $bin, bool $trust = true, bool $unsigned = false)
15
    {
16 10
        $this->alias = $alias;
17 10
        $this->bin = $bin;
18 10
        $this->trust = $trust;
19 10
        $this->unsigned = $unsigned;
20
    }
21
22 7
    public function __toString(): string
23
    {
24 7
        return \sprintf(
25 7
            'phive install %s %s %s -t %s',
26 7
            $this->trust ? '--trust-gpg-keys' : '',
27 7
            $this->unsigned ? '--force-accept-unsigned' : '',
28 7
            $this->alias,
29 7
            $this->bin
30
        );
31
    }
32
}
33