| Conditions | 2 |
| Paths | 2 |
| Total Lines | 16 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 27 | public function registerComposer(ConsoleEvent $event) |
||
| 28 | { |
||
| 29 | /* |
||
| 30 | * Inject composer object in composer commands |
||
| 31 | */ |
||
| 32 | $command = $event->getCommand(); |
||
| 33 | if (strstr(get_class($command), 'Composer\\Command\\')) { |
||
| 34 | $io = new ConsoleIO($event->getInput(), $event->getOutput(), $command->getHelperSet()); |
||
|
|
|||
| 35 | $magentoRootFolder = $command->getApplication()->getMagentoRootFolder(); |
||
| 36 | $configFile = $magentoRootFolder . '/composer.json'; |
||
| 37 | $composer = Factory::create($io, $configFile); |
||
| 38 | \chdir($magentoRootFolder); |
||
| 39 | $command->setComposer($composer); |
||
| 40 | $command->setIO($io); |
||
| 41 | } |
||
| 42 | } |
||
| 43 | } |
||
| 44 |
Unless you are absolutely sure that the expression can never be null because of other conditions, we strongly recommend to add an additional type check to your code: