Passed
Push — master ( 29521a...b34be3 )
by Alexander
24:53 queued 23:31
created

WrapperFactory::createCallableWrapper()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
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
10
final class WrapperFactory
11
{
12
    private ContainerInterface $container;
13
    private RequestModelFactory $requestModelFactory;
14
15 6
    public function __construct(ContainerInterface $container, RequestModelFactory $requestModelFactory)
16
    {
17 6
        $this->container = $container;
18 6
        $this->requestModelFactory = $requestModelFactory;
19 6
    }
20
21 2
    public function createCallableWrapper(callable $callback): MiddlewareInterface
22
    {
23 2
        return new CallableWrapper($this->container, $this->requestModelFactory, $callback);
24
    }
25
26 2
    public function createActionWrapper(string $class, string $method): MiddlewareInterface
27
    {
28 2
        return new ActionWrapper($this->container, $this->requestModelFactory, $class, $method);
29
    }
30
}
31