ComposerBinPluginLinkCommand   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 12
dl 0
loc 20
ccs 10
cts 10
cp 1
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __toString() 0 7 1
A __construct() 0 5 1
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