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

Breadcrumb

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

function RunScriptCommand::getScripts

Return value

list<array{name: string, description: string}>

2 calls to RunScriptCommand::getScripts()
RunScriptCommand::interact in vendor/composer/composer/src/Composer/Command/RunScriptCommand.php
Interacts with the user.
RunScriptCommand::listScripts in vendor/composer/composer/src/Composer/Command/RunScriptCommand.php

File

vendor/composer/composer/src/Composer/Command/RunScriptCommand.php, line 164

Class

RunScriptCommand
@author Fabien Potencier <fabien.potencier@gmail.com>

Namespace

Composer\Command

Code

private function getScripts() : array {
    $scripts = $this->requireComposer()
        ->getPackage()
        ->getScripts();
    if (count($scripts) === 0) {
        return [];
    }
    $result = [];
    foreach ($scripts as $name => $script) {
        $description = '';
        try {
            $cmd = $this->getApplication()
                ->find($name);
            if ($cmd instanceof ScriptAliasCommand) {
                $description = $cmd->getDescription();
            }
        } catch (\Symfony\Component\Console\Exception\CommandNotFoundException $e) {
            // ignore scripts that have no command associated, like native Composer script listeners
        }
        $result[] = [
            'name' => $name,
            'description' => $description,
        ];
    }
    return $result;
}

API Navigation

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