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

Breadcrumb

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

function DiagnoseCommand::getGithubRateLimit

Parameters

string $token:

Return value

mixed|string

Throws

TransportException

1 call to DiagnoseCommand::getGithubRateLimit()
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 474

Class

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

Namespace

Composer\Command

Code

private function getGithubRateLimit(string $domain, ?string $token = null) {
    $result = $this->checkConnectivityAndComposerNetworkHttpEnablement();
    if ($result !== true) {
        return $result;
    }
    if ($token) {
        $this->getIO()
            ->setAuthentication($domain, $token, 'x-oauth-basic');
    }
    $url = $domain === 'github.com' ? 'https://api.' . $domain . '/rate_limit' : 'https://' . $domain . '/api/rate_limit';
    $data = $this->httpDownloader
        ->get($url, [
        'retry-auth-failure' => false,
    ])
        ->decodeJson();
    return $data['resources']['core'];
}

API Navigation

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