Completed
Pull Request — v2 (#16)
by Faouzi
02:28
created

Config   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 4
c 2
b 0
f 0
lcom 0
cbo 2
dl 0
loc 45
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 2
A register() 0 6 1
A registerEnvironmentParams() 0 14 1
1
<?php
2
3
namespace TestRabbitMq;
4
5
use Pimple\Container;
6
use Pimple\ServiceProviderInterface;
7
8
/**
9
 * Configuration principale de l'application
10
 */
11
class Config implements ServiceProviderInterface
12
{
13
    /**
14
     * @params string $env
15
     */
16
    public function __construct()
17
    {
18
        if (true === file_exists(__DIR__ . "/env/testing.php")) {
19
            require_once __DIR__ . "/env/testing.php";
20
        }
21
    }
22
23
    /**
24
     * @{inherit doc}
25
     */
26
    public function register(Container $app)
27
    {
28
        $this->registerEnvironmentParams($app);
29
30
        $app->register(new EtnaConfig());
31
    }
32
33
    /**
34
     * Set up environmental variables
35
     *
36
     * If development environment, set xdebug to display all the things
37
     *
38
     * @param Container $app Pimple Container
39
     *
40
     */
41
    private function registerEnvironmentParams(Container $app)
42
    {
43
        $app['application_name']      = 'test_rabbitmq';
44
        $app['application_env']       = 'testing';
45
        $app['application_path']      = realpath(__DIR__ . "/../");
46
        $app['application_namespace'] = __NAMESPACE__;
47
48
        ini_set('display_errors', true);
49
        ini_set('xdebug.var_display_max_depth', 100);
50
        ini_set('xdebug.var_display_max_children', 100);
51
        ini_set('xdebug.var_display_max_data', 100);
52
        error_reporting(E_ALL);
53
        $app["debug"] = true;
54
    }
55
}
56