Passed
Pull Request — master (#1)
by
unknown
14:51
created

WrapperFactory::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

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