Completed
Push — master ( 559eff...88f0ac )
by Thibaud
06:36
created

MiddlewareServiceProvider   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 5

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 0
cbo 5
dl 0
loc 27
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A register() 0 18 1
A boot() 0 4 1
1
<?php
2
3
namespace Alchemy\RestProvider;
4
5
use Silex\Application;
6
use Silex\ServiceProviderInterface;
7
8
class MiddlewareServiceProvider implements ServiceProviderInterface
9
{
10
11
    public function register(Application $app)
12
    {
13
        $app['alchemy_rest.middleware.parse_date_params'] = $app->share(function () {
14
            return new Middleware\SetDateAttributesMiddlewareFactory();
15
        });
16
17
        $app['alchemy_rest.middleware.parse_list_params'] = $app->share(function () {
18
            return new Middleware\SetPaginationAndSortAttributesMiddlewareFactory();
19
        });
20
21
        $app['alchemy_rest.middleware.transform_response'] = $app->share(function () {
22
            return new Middleware\SetTransformAttributeMiddlewareFactory();
23
        });
24
25
        $app['alchemy_rest.middleware.json_encoder'] = $app->share(function () {
26
            return new Middleware\SetEncodingAttributeMiddlewareFactory();
27
        });
28
    }
29
30
    public function boot(Application $app)
31
    {
32
        // no-op
33
    }
34
}
35