Conditions | 6 |
Paths | 8 |
Total Lines | 28 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
9 | public static function buildParameters(Event $event) |
||
10 | { |
||
11 | $extras = $event->getComposer()->getPackage()->getExtra(); |
||
12 | |||
13 | if (!isset($extras['incenteev-parameters'])) { |
||
14 | throw new \InvalidArgumentException('The parameter handler needs to be configured through the extra.incenteev-parameters setting.'); |
||
15 | } |
||
16 | |||
17 | $configs = $extras['incenteev-parameters']; |
||
18 | |||
19 | if (!is_array($configs)) { |
||
20 | throw new \InvalidArgumentException('The extra.incenteev-parameters setting must be an array or a configuration object.'); |
||
21 | } |
||
22 | |||
23 | if (array_keys($configs) !== range(0, count($configs) - 1)) { |
||
24 | $configs = [$configs]; |
||
25 | } |
||
26 | |||
27 | $processor = new Processor($event->getIO()); |
||
28 | |||
29 | foreach ($configs as $config) { |
||
30 | if (!is_array($config)) { |
||
31 | throw new \InvalidArgumentException('The extra.incenteev-parameters setting must be an array of configuration objects.'); |
||
32 | } |
||
33 | |||
34 | $processor->processFile($config); |
||
35 | } |
||
36 | } |
||
37 | } |
||
38 |