| Conditions | 3 |
| Paths | 2 |
| Total Lines | 26 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 12 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 20 | public function read(Aliases $aliases): ResponseInterface |
||
| 21 | { |
||
| 22 | $command = new BashCommand($aliases, [ |
||
| 23 | 'composer', |
||
| 24 | 'yii-config-merge-plan', |
||
| 25 | ]); |
||
| 26 | $output = $command->run()->getResult(); |
||
| 27 | $mergePlanPath = substr($output, 0, strpos($output, 'Xdebug: [Step Debug]') ?: -1); |
||
| 28 | |||
| 29 | if (!file_exists($mergePlanPath)) { |
||
| 30 | throw new Exception( |
||
| 31 | sprintf( |
||
| 32 | 'Could not find composer.json by the path "%s".', |
||
| 33 | $mergePlanPath, |
||
| 34 | ) |
||
| 35 | ); |
||
| 36 | } |
||
| 37 | |||
| 38 | $content = require $mergePlanPath; |
||
| 39 | |||
| 40 | $result = [ |
||
| 41 | 'path' => $mergePlanPath, |
||
| 42 | 'data' => $content, |
||
| 43 | ]; |
||
| 44 | |||
| 45 | return $this->responseFactory->createResponse($result); |
||
| 46 | } |
||
| 48 |