Test Failed
Pull Request — master (#51)
by Rustam
02:13
created

WrapperFactory   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 4
c 1
b 0
f 0
dl 0
loc 17
ccs 5
cts 5
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A create() 0 6 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\RequestModel;
6
7
use Psr\Container\ContainerInterface;
8
use Psr\Http\Server\MiddlewareInterface;
9
use Yiisoft\Middleware\Dispatcher\WrapperFactoryInterface;
0 ignored issues
show
Bug introduced by
The type Yiisoft\Middleware\Dispa...WrapperFactoryInterface 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
11
final class WrapperFactory implements WrapperFactoryInterface
12 6
{
13
    public function __construct(
14
        private ContainerInterface $container,
15
        private HandlerParametersResolver $parametersResolver
16
    ) {
17
    }
18 2
19
    /**
20 2
     * {@inheritDoc}
21
     */
22
    public function create($callable): MiddlewareInterface
23 2
    {
24
        if (is_array($callable)) {
25 2
            return new ActionWrapper($this->container, $this->parametersResolver, $callable[0], $callable[1]);
26
        }
27
        return new CallableWrapper($this->container, $this->parametersResolver, $callable);
28
    }
29
}
30