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

Breadcrumb

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

function GitLabDriver::supports

Uses the config `gitlab-domains` to see if the driver supports the url for the repository given.

@inheritDoc

Overrides VcsDriverInterface::supports

File

vendor/composer/composer/src/Composer/Repository/Vcs/GitLabDriver.php, line 561

Class

GitLabDriver
Driver for GitLab API, use the Git driver for local checkouts.

Namespace

Composer\Repository\Vcs

Code

public static function supports(IOInterface $io, Config $config, string $url, bool $deep = false) : bool {
    if (!Preg::isMatch(self::URL_REGEX, $url, $match)) {
        return false;
    }
    $scheme = $match['scheme'];
    $guessedDomain = $match['domain'] ?? (string) $match['domain2'];
    $urlParts = explode('/', $match['parts']);
    if (false === self::determineOrigin($config->get('gitlab-domains'), $guessedDomain, $urlParts, $match['port'])) {
        return false;
    }
    if ('https' === $scheme && !extension_loaded('openssl')) {
        $io->writeError('Skipping GitLab driver for ' . $url . ' because the OpenSSL PHP extension is missing.', true, IOInterface::VERBOSE);
        return false;
    }
    return true;
}
RSS feed
Powered by Drupal