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

WrapperFactory   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 19
ccs 8
cts 8
cp 1
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A createActionWrapper() 0 3 1
A createCallableWrapper() 0 3 1
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