Provider::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 6
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
crap 1
1
<?php
2
declare(strict_types=1);
3
4
5
namespace Xervice\Shell\Business\Provider;
6
7
8
use Xervice\Shell\Business\Command\ConverterInterface;
9
use Xervice\Shell\Business\Executor\ExecutorInterface;
10
11
class Provider implements ProviderInterface
12
{
13
    /**
14
     * @var ExecutorInterface
15
     */
16
    private $executor;
17
18
    /**
19
     * @var \Xervice\Shell\Business\Command\ConverterInterface
20
     */
21
    private $conveter;
22
23
    /**
24
     * Provider constructor.
25
     *
26
     * @param \Xervice\Shell\Business\Executor\ExecutorInterface $executor
27
     * @param \Xervice\Shell\Business\Command\ConverterInterface $conveter
28
     */
29 1
    public function __construct(
30
        ExecutorInterface $executor,
31
        ConverterInterface $conveter
32
    ) {
33 1
        $this->executor = $executor;
34 1
        $this->conveter = $conveter;
35 1
    }
36
37
38
    /**
39
     * @param string $command
40
     * @param mixed ...$params
41
     *
42
     * @return string
43
     */
44 1
    public function execute(string $command, ...$params): string
45
    {
46 1
        return $this->executor->execute(
47 1
            $this->conveter->convert($command, ...$params)
48
        );
49
    }
50
}