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

Breadcrumb

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

function GitHubDriver::supports

@inheritDoc

Overrides VcsDriverInterface::supports

File

vendor/composer/composer/src/Composer/Repository/Vcs/GitHubDriver.php, line 398

Class

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

Namespace

Composer\Repository\Vcs

Code

public static function supports(IOInterface $io, Config $config, string $url, bool $deep = false) : bool {
    if (!Preg::isMatch('#^((?:https?|git)://([^/]+)/|git@([^:]+):/?)([^/]+)/([^/]+?)(?:\\.git|/)?$#', $url, $matches)) {
        return false;
    }
    $originUrl = $matches[2] ?? (string) $matches[3];
    if (!in_array(strtolower(Preg::replace('{^www\\.}i', '', $originUrl)), $config->get('github-domains'))) {
        return false;
    }
    if (!extension_loaded('openssl')) {
        $io->writeError('Skipping GitHub driver for ' . $url . ' because the OpenSSL PHP extension is missing.', true, IOInterface::VERBOSE);
        return false;
    }
    return true;
}
RSS feed
Powered by Drupal