Test Failed
Push — master ( 6db55f...0b650e )
by Chris
21:02
created

SlimRouterProvider   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 10
c 0
b 0
f 0
dl 0
loc 14
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A create() 0 12 2
1
<?php
2
3
namespace Leonidas\Framework\Site\Provider;
4
5
use Panamax\Contracts\ServiceFactoryInterface;
6
use Panamax\Factories\AbstractServiceFactory;
7
use Psr\Container\ContainerInterface;
8
use Psr\Http\Message\ResponseFactoryInterface;
9
use Slim\CallableResolver;
10
use Slim\Interfaces\RouteCollectorInterface;
11
use Slim\Routing\RouteCollectorProxy;
12
13
class SlimRouterProvider extends AbstractServiceFactory implements ServiceFactoryInterface
14
{
15
    public function create(ContainerInterface $container, array $args = []): RouteCollectorProxy
16
    {
17
        $routeCollector = $container->has(RouteCollectorInterface::class)
18
            ? $container->get(RouteCollectorInterface::class)
19
            : null;
20
21
        return new RouteCollectorProxy(
22
            $container->get(ResponseFactoryInterface::class),
23
            new CallableResolver($container),
24
            $container,
25
            $routeCollector,
26
            $args['group_pattern'] ?? ''
27
        );
28
    }
29
}
30