ServiceProvider   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 5

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 5
dl 0
loc 24
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A register() 0 21 1
1
<?php
2
3
namespace Eole\Sandstone\Websocket;
4
5
use Symfony\Component\Routing\RouteCollection;
6
use Symfony\Component\Routing\RequestContext;
7
use Symfony\Component\Routing\Matcher\UrlMatcher;
8
use Pimple\Container;
9
use Pimple\ServiceProviderInterface;
10
use Eole\Sandstone\Websocket\Routing\TopicRouter;
11
use Eole\Sandstone\Websocket\Routing\TopicCollection;
12
13
class ServiceProvider implements ServiceProviderInterface
14
{
15
    public function register(Container $app)
16
    {
17
        $app['sandstone.websocket.routes'] = function () {
18
            return new RouteCollection();
19
        };
20
21
        $app['sandstone.websocket.topics'] = function () use ($app) {
22
            return new TopicCollection($app['sandstone.websocket.routes']);
23
        };
24
25
        $app['sandstone.websocket.url_matcher'] = function () use ($app) {
26
            return new UrlMatcher(
27
                $app['sandstone.websocket.routes'],
28
                new RequestContext()
29
            );
30
        };
31
32
        $app['sandstone.websocket.router'] = function () use ($app) {
33
            return new TopicRouter($app['sandstone.websocket.url_matcher']);
34
        };
35
    }
36
}
37