Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Application.php

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\Console

Code

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;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal