Test Failed
Pull Request — master (#872)
by Maxim
10:54 queued 03:52
created

AttributeInterceptor::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Spiral\Console\Interceptor;
6
7
use Spiral\Console\Command;
8
use Spiral\Console\Configurator\Attribute\Parser;
9
use Spiral\Core\CoreInterceptorInterface;
10
use Spiral\Core\CoreInterface;
11
use Symfony\Component\Console\Input\InputInterface;
12
13
final class AttributeInterceptor implements CoreInterceptorInterface
14
{
15
    public function __construct(
16
        private readonly Parser $parser
17
    ) {
18
    }
19
20
    public function process(string $controller, string $action, array $parameters, CoreInterface $core): int
21
    {
22
        \assert($parameters['input'] instanceof InputInterface);
23
        \assert($parameters['command'] instanceof Command);
24
25
        $this->parser->fillProperties($parameters['command'], $parameters['input']);
26
27
        return $core->callAction($controller, $action, $parameters);
28
    }
29
}
30