Test Failed
Pull Request — master (#369)
by Mihai
03:21
created

PhiveInstallCommand::__toString()   A

Complexity

Conditions 2
Paths 1

Size

Total Lines 9
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 7
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 9
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 $unsigned;
12
13
14
    public function __construct(string $alias, string $bin, bool $unsigned = true)
15
    {
16
        $this->alias = $alias;
17
        $this->bin = $bin;
18
        $this->unsigned = $unsigned;
19
    }
20
21
    public function __toString(): string
22
    {
23
        $home = dirname($this->bin);
24
        return \sprintf(
25
            'phive --home %s install %s %s -t %s',
26
            $home,
27
            $this->unsigned ? '--force-accept-unsigned' : '',
28
            $this->alias,
29
            $this->bin
30
        );
31
    }
32
}
33