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

Breadcrumb

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

function HomeCommand::execute

Overrides Command::execute

File

vendor/composer/composer/src/Composer/Command/HomeCommand.php, line 60

Class

HomeCommand
@author Robert Schönthal <seroscho@googlemail.com>

Namespace

Composer\Command

Code

protected function execute(InputInterface $input, OutputInterface $output) : int {
    $repos = $this->initializeRepos();
    $io = $this->getIO();
    $return = 0;
    $packages = $input->getArgument('packages');
    if (count($packages) === 0) {
        $io->writeError('No package specified, opening homepage for the root package');
        $packages = [
            $this->requireComposer()
                ->getPackage()
                ->getName(),
        ];
    }
    foreach ($packages as $packageName) {
        $handled = false;
        $packageExists = false;
        foreach ($repos as $repo) {
            foreach ($repo->findPackages($packageName) as $package) {
                $packageExists = true;
                if ($package instanceof CompletePackageInterface && $this->handlePackage($package, $input->getOption('homepage'), $input->getOption('show'))) {
                    $handled = true;
                    break 2;
                }
            }
        }
        if (!$packageExists) {
            $return = 1;
            $io->writeError('<warning>Package ' . $packageName . ' not found</warning>');
        }
        if (!$handled) {
            $return = 1;
            $io->writeError('<warning>' . ($input->getOption('homepage') ? 'Invalid or missing homepage' : 'Invalid or missing repository URL') . ' for ' . $packageName . '</warning>');
        }
    }
    return $return;
}

API Navigation

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