Passed
Pull Request — master (#1)
by Alexander
24:23 queued 09:19
created

WrapperFactory::createCallableWrapper()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

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