TestTools::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php declare(strict_types=1);
2
3
namespace Zalas\Toolbox\UseCase;
4
5
use Zalas\Toolbox\Tool\Command;
6
use Zalas\Toolbox\Tool\Command\MultiStepCommand;
7
use Zalas\Toolbox\Tool\Filter;
8
use Zalas\Toolbox\Tool\Tool;
9
use Zalas\Toolbox\Tool\Tools;
10
11
class TestTools
12
{
13
    private Tools $tools;
14
15 2
    public function __construct(Tools $tools)
16
    {
17 2
        $this->tools = $tools;
18
    }
19
20 1
    public function __invoke(Filter $filter): Command
21
    {
22 1
        return new MultiStepCommand(
23 1
            $this->tools->all($filter)->map(function (Tool $tool) {
24 1
                return $tool->testCommand();
25 1
            })
26 1
        );
27
    }
28
}
29