Conditions | 7 |
Paths | 17 |
Total Lines | 32 |
Code Lines | 19 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
16 | public function call() |
||
17 | { |
||
18 | $builder = $this->getBuilder(); |
||
19 | |||
20 | $commands = $this->getParam('commands', []); |
||
21 | |||
22 | foreach ($commands as $command => $data) { |
||
23 | $params = $data['params'] ?? []; |
||
24 | $result = $data['result'] ?? null; |
||
25 | |||
26 | $params = ! is_array($params) ? [ |
||
27 | $params |
||
28 | ] : $params; |
||
29 | |||
30 | try { |
||
31 | ArtisanFacade::call($command, $params); |
||
32 | |||
33 | $output = ArtisanFacade::output(); |
||
34 | |||
35 | if ($output) { |
||
36 | if ($result && ! preg_match("|{$result}|", $output)) { |
||
37 | $builder->down(); |
||
38 | } |
||
39 | } else { |
||
40 | $builder->down(); |
||
41 | } |
||
42 | } catch (\Exception $e) { |
||
43 | $builder->down()->withData('error', $e->getMessage()); |
||
44 | } |
||
45 | } |
||
46 | |||
47 | return $builder->build(); |
||
48 | } |
||
50 |