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

MiddlewareServiceProvider::register()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 18
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 18
rs 9.4285
cc 1
eloc 9
nc 1
nop 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