RepositoryServiceProvider   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 2
c 1
b 0
f 1
lcom 0
cbo 3
dl 0
loc 33
rs 10
ccs 11
cts 11
cp 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A register() 0 12 1
A boot() 0 4 1
1
<?php
2
3
namespace OpenTribes\Core\Silex\Provider;
4
5
6
use OpenTribes\Core\Test\Mock\Repository\MockCityRepository;
7
use OpenTribes\Core\Silex\Repository;
8
use Silex\Application;
9
use Silex\ServiceProviderInterface;
10
11
class RepositoryServiceProvider implements ServiceProviderInterface {
12
    /**
13
     * Registers services on the given app.
14
     *
15
     * This method should only be used to configure services and parameters.
16
     * It should not get services.
17
     */
18 35
    public function register(Application $app)
19
    {
20
        $app[Repository::USER] = $app->share(function () use ($app) {
21 33
            return new Repository\DBALUserRepository($app['db']);
22 35
        });
23
        $app[Repository::CITY] = $app->share(function()use($app){
24 4
            return new MockCityRepository();
25 35
        });
26 35
        $app[Repository::DIRECTION] = $app->share(function()use($app){
27 5
            return new Repository\ConfigDirectionsRepository($app['directions']);
28 35
        });
29 35
    }
30
31
    /**
32
     * Bootstraps the application.
33
     *
34
     * This method is called after all services are registered
35
     * and should be used for "dynamic" configuration (whenever
36
     * a service must be requested).
37
     */
38 35
    public function boot(Application $app)
39
    {
40
41 35
    }
42
43
}