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

AttributeInterceptor   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 5
dl 0
loc 15
rs 10
c 0
b 0
f 0

2 Methods

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