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

WrapperFactory::create()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 3
c 0
b 0
f 0
dl 0
loc 6
ccs 2
cts 2
cp 1
rs 10
cc 2
nc 2
nop 1
crap 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