ComposerBinPluginLinkCommand::__toString()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 5
nc 1
nop 0
dl 0
loc 7
ccs 6
cts 6
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php declare(strict_types=1);
2
3
namespace Zalas\Toolbox\Tool\Command;
4
5
use Zalas\Toolbox\Tool\Command;
6
7
final class ComposerBinPluginLinkCommand implements Command
8
{
9
    private string $source;
10
    private string $target;
11
    private string $namespace;
12
13 5
    public function __construct(string $source, string $target, string $namespace)
14
    {
15 5
        $this->source = $source;
16 5
        $this->target = $target;
17 5
        $this->namespace = $namespace;
18
    }
19
20 3
    public function __toString(): string
21
    {
22 3
        return \sprintf(
23 3
            'ln -sf ${COMPOSER_HOME:-"~/.composer"}/vendor-bin/%s/vendor/bin/%s %s',
24 3
            $this->namespace,
25 3
            $this->source,
26 3
            $this->target
27 3
        );
28
    }
29
}
30