| Conditions | 3 |
| Paths | 3 |
| Total Lines | 23 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 29 | private static function getConfigurations(Event $event) |
||
| 30 | { |
||
| 31 | $baseDir = $event->getComposer()->getConfig()->get('vendor-dir') . '/../'; |
||
| 32 | |||
| 33 | $defaults = [ |
||
| 34 | 'componentsDir' => $baseDir . 'components/', |
||
| 35 | ]; |
||
| 36 | |||
| 37 | $file = $baseDir . '.maristela-cli.json'; |
||
| 38 | |||
| 39 | if (!file_exists($file)) { |
||
| 40 | return $defaults; |
||
| 41 | } |
||
| 42 | |||
| 43 | $config = json_decode(file_get_contents($file), true); |
||
| 44 | |||
| 45 | if (empty($config['componentsDir'])) { |
||
| 46 | throw new Exception('The "componentsDir" is not defined on config file.'); |
||
|
|
|||
| 47 | } |
||
| 48 | |||
| 49 | $config['componentsDir'] = "{$baseDir}{$config['componentsDir']}"; |
||
| 50 | |||
| 51 | return array_merge($defaults, $config); |
||
| 52 | } |
||
| 54 |