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

Breadcrumb

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

function DiagnoseCommand::checkComposerRepo

Return value

string|string[]|true

1 call to DiagnoseCommand::checkComposerRepo()
DiagnoseCommand::execute in vendor/composer/composer/src/Composer/Command/DiagnoseCommand.php
Executes the current command.

File

vendor/composer/composer/src/Composer/Command/DiagnoseCommand.php, line 364

Class

DiagnoseCommand
@author Jordi Boggiano <j.boggiano@seld.be>

Namespace

Composer\Command

Code

private function checkComposerRepo(string $url, Config $config) {
    $result = $this->checkConnectivityAndComposerNetworkHttpEnablement();
    if ($result !== true) {
        return $result;
    }
    $result = [];
    if (str_starts_with($url, 'https://') && $config->get('disable-tls') === true) {
        $tlsWarning = '<warning>Composer is configured to disable SSL/TLS protection. This will leave remote HTTPS requests vulnerable to Man-In-The-Middle attacks.</warning>';
    }
    try {
        $this->httpDownloader
            ->get($url);
    } catch (TransportException $e) {
        $hints = HttpDownloader::getExceptionHints($e);
        if (null !== $hints && count($hints) > 0) {
            foreach ($hints as $hint) {
                $result[] = $hint;
            }
        }
        $result[] = '<error>[' . get_class($e) . '] ' . $e->getMessage() . '</error>';
    }
    if (isset($tlsWarning)) {
        $result[] = $tlsWarning;
    }
    if (count($result) > 0) {
        return $result;
    }
    return true;
}

API Navigation

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