ControllerServiceProvider   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Test Coverage

Coverage 100%

Importance

Changes 10
Bugs 0 Features 7
Metric Value
wmc 2
c 10
b 0
f 7
lcom 0
cbo 4
dl 0
loc 39
rs 10
ccs 14
cts 14
cp 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A register() 0 15 1
A boot() 0 4 1
1
<?php
2
3
namespace OpenTribes\Core\Silex\Provider;
4
5
use OpenTribes\Core\Silex\Controller;
6
use OpenTribes\Core\Silex\Repository;
7
use OpenTribes\Core\Silex\Service;
8
use OpenTribes\Core\Silex\UseCase;
9
use OpenTribes\Core\Silex\Validator;
10
use Silex\Application;
11
use Silex\ServiceProviderInterface;
12
13
class ControllerServiceProvider implements ServiceProviderInterface
14
{
15
    /**
16
     * Registers services on the given app.
17
     *
18
     * This method should only be used to configure services and parameters.
19
     * It should not get services.
20
     *
21
     * @param Application $app An Application instance
22
     */
23 35
    public function register(Application $app)
24
    {
25
        $app[Controller::INDEX] = $app->share(function () use ($app) {
26 10
            return new Controller\IndexController($app[UseCase::LOGIN]);
27 35
        });
28
        $app[Controller::ACCOUNT] = $app->share(function () use ($app) {
29 15
            return new Controller\AccountController($app[UseCase::REGISTRATION], $app[Repository::USER]);
30 35
        });
31 35
        $app[Controller::CITY] = $app->share(function () use ($app) {
32 4
            return new Controller\CityController(
33 4
                $app[UseCase::LIST_DIRECTIONS],
34 4
                $app[Repository::USER],
35 4
                $app[Repository::CITY]);
36 35
        });
37 35
    }
38
39
    /**
40
     * Bootstraps the application.
41
     *
42
     * This method is called after all services are registered
43
     * and should be used for "dynamic" configuration (whenever
44
     * a service must be requested).
45
     */
46 35
    public function boot(Application $app)
47
    {
48
        // TODO: Implement boot() method.
49 35
    }
50
51
}