function Application::getPluginCommands
Return value
Command\BaseCommand[]
1 call to Application::getPluginCommands()
- Application::doRun in vendor/
composer/ composer/ src/ Composer/ Console/ Application.php - Runs the current application.
File
-
vendor/
composer/ composer/ src/ Composer/ Console/ Application.php, line 665
Class
- Application
- The console application that handles the commands
Namespace
Composer\ConsoleCode
private function getPluginCommands() : array {
$commands = [];
$composer = $this->getComposer(false, false);
if (null === $composer) {
$composer = Factory::createGlobal($this->io, $this->disablePluginsByDefault, $this->disableScriptsByDefault);
}
if (null !== $composer) {
$pm = $composer->getPluginManager();
foreach ($pm->getPluginCapabilities('Composer\\Plugin\\Capability\\CommandProvider', [
'composer' => $composer,
'io' => $this->io,
]) as $capability) {
$newCommands = $capability->getCommands();
if (!is_array($newCommands)) {
throw new \UnexpectedValueException('Plugin capability ' . get_class($capability) . ' failed to return an array from getCommands');
}
foreach ($newCommands as $command) {
if (!$command instanceof Command\BaseCommand) {
throw new \UnexpectedValueException('Plugin capability ' . get_class($capability) . ' returned an invalid value, we expected an array of Composer\\Command\\BaseCommand objects');
}
}
$commands = array_merge($commands, $newCommands);
}
}
return $commands;
}