TestTools   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

2 Methods

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