Passed
Push — master ( 519e38...1265b7 )
by Melech
01:25
created

RouteMatchedHandler   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 13
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A routeMatched() 0 8 2
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the Valkyrja Framework package.
7
 *
8
 * (c) Melech Mizrachi <[email protected]>
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Valkyrja\Cli\Middleware\Handler;
15
16
use Override;
0 ignored issues
show
Bug introduced by
The type Override was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
17
use Valkyrja\Cli\Interaction\Input\Contract\InputContract;
18
use Valkyrja\Cli\Interaction\Output\Contract\OutputContract;
19
use Valkyrja\Cli\Middleware\Contract\RouteMatchedMiddlewareContract;
20
use Valkyrja\Cli\Middleware\Handler\Abstract\Handler;
21
use Valkyrja\Cli\Middleware\Handler\Contract\RouteMatchedHandlerContract as Contract;
22
use Valkyrja\Cli\Routing\Data\Contract\RouteContract;
23
24
/**
25
 * @extends Handler<RouteMatchedMiddlewareContract>
26
 */
27
class RouteMatchedHandler extends Handler implements Contract
28
{
29
    /**
30
     * @inheritDoc
31
     */
32
    #[Override]
33
    public function routeMatched(InputContract $input, RouteContract $route): RouteContract|OutputContract
34
    {
35
        $next = $this->next;
36
37
        return $next !== null
38
            ? $this->getMiddleware($next)->routeMatched($input, $route, $this)
39
            : $route;
40
    }
41
}
42