Passed
Pull Request — master (#581)
by Alexander
02:32 queued 57s
created

RouteResolver::getParameterValue()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 3
nc 2
nop 2
dl 0
loc 7
rs 10
c 1
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\RouteAttribute;
6
7
use Vjik\InputHydrator\Context;
0 ignored issues
show
Bug introduced by
The type Vjik\InputHydrator\Context 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...
8
use Vjik\InputHydrator\NotResolvedException;
0 ignored issues
show
Bug introduced by
The type Vjik\InputHydrator\NotResolvedException 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...
9
use Vjik\InputHydrator\ParameterAttributeInterface;
0 ignored issues
show
Bug introduced by
The type Vjik\InputHydrator\ParameterAttributeInterface 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...
10
use Vjik\InputHydrator\ParameterAttributeResolverInterface;
0 ignored issues
show
Bug introduced by
The type Vjik\InputHydrator\Param...ributeResolverInterface 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...
11
use Vjik\InputHydrator\UnexpectedAttributeException;
0 ignored issues
show
Bug introduced by
The type Vjik\InputHydrator\UnexpectedAttributeException 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...
12
use Yiisoft\Router\CurrentRoute;
0 ignored issues
show
Bug introduced by
The type Yiisoft\Router\CurrentRoute 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...
13
14
final class RouteResolver implements ParameterAttributeResolverInterface
15
{
16
    public function __construct(private CurrentRoute $currentRoute)
17
    {
18
    }
19
20
    public function getParameterValue(ParameterAttributeInterface $attribute, Context $context): mixed
21
    {
22
        if (!$attribute instanceof Route) {
23
            throw new UnexpectedAttributeException(Route::class, $attribute);
24
        }
25
26
        return $this->currentRoute->getArgument($attribute->getName()) ?? throw new NotResolvedException();
27
    }
28
}
29