| Conditions | 4 |
| Paths | 1 |
| Total Lines | 23 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 11 | public function register(Application $app) |
||
| 12 | { |
||
| 13 | $this->app = $app; |
||
| 14 | |||
| 15 | $app['config'] = $app->share( |
||
| 16 | function () use ($app) { |
||
| 17 | $config = array(); |
||
| 18 | foreach ($app['config.paths'] as $path) { |
||
| 19 | if (!file_exists($path)) { |
||
| 20 | continue; |
||
| 21 | } |
||
| 22 | $parser = new Yaml\Parser(); |
||
| 23 | $result = @file_get_contents($path); |
||
| 24 | if($result === FALSE) { |
||
| 25 | $result = $app['process']->executeSudoCommand("cat " . $path, true); |
||
| 26 | } |
||
| 27 | $config = array_replace_recursive($config, $parser->parse($result)); |
||
| 28 | } |
||
| 29 | |||
| 30 | return $config; |
||
| 31 | } |
||
| 32 | ); |
||
| 33 | } |
||
| 34 | } |
||
| 35 |