Conditions | 4 |
Paths | 11 |
Total Lines | 29 |
Lines | 0 |
Ratio | 0 % |
Tests | 12 |
CRAP Score | 4.0072 |
Changes | 0 |
1 | <?php namespace Comodojo\Foundation\Base; |
||
23 | 3 | public static function load($file, array $attributes = []) { |
|
24 | |||
25 | 3 | $conf = new Configuration($attributes); |
|
26 | |||
27 | try { |
||
28 | |||
29 | 3 | $conf->merge(static::importData($file)); |
|
30 | |||
31 | 3 | $base = $conf->get('base-path'); |
|
32 | 3 | $static = $conf->get('static-config'); |
|
33 | 3 | $env = $conf->get('env-config'); |
|
34 | |||
35 | 3 | if ( $env !== null ) { |
|
36 | |||
37 | 3 | $env_path = substr($env, 0, 1) === '/' ? $env : "$base/$static/$env"; |
|
38 | |||
39 | 3 | $conf->merge(static::importData($env_path)); |
|
40 | |||
41 | 3 | } |
|
42 | |||
43 | 3 | } catch (Exception $e) { |
|
44 | |||
45 | throw $e; |
||
46 | |||
47 | } |
||
48 | |||
49 | 3 | return $conf; |
|
50 | |||
51 | } |
||
52 | |||
54 |