src/Composer/IO/BaseIO.php
public function loadConfiguration(Config $config)
    {
        $bitbucketOauth = $config->get('bitbucket-oauth') ?: array();
        $githubOauth = $config->get('github-oauth') ?: array();
        $gitlabOauth = $config->get('gitlab-oauth') ?: array();
        $gitlabToken = $config->get('gitlab-token') ?: array();
        $httpBasic = $config->get('http-basic') ?: array();

        // reload oauth tokens from config if available

        foreach ($bitbucketOauth as $domain => $cred) {
            $this->checkAndSetAuthentication($domain, $cred['consumer-key'], $cred['consumer-secret']);
        }

        foreach ($githubOauth as $domain => $token) {
            if (!preg_match('{^[.a-z0-9]+$}', $token)) {
                throw new \UnexpectedValueException('Your github oauth token for '.$domain.' contains invalid characters: "'.$token.'"');
            }
            $this->checkAndSetAuthentication($domain, $token, 'x-oauth-basic');
        }

        foreach ($gitlabOauth as $domain => $token) {
            $this->checkAndSetAuthentication($domain, $token, 'oauth2');
        }

        foreach ($gitlabToken as $domain => $token) {
            $this->checkAndSetAuthentication($domain, $token, 'private-token');
        }

        // reload http basic credentials from config if available
        foreach ($httpBasic as $domain => $cred) {
            $this->checkAndSetAuthentication($domain, $cred['username'], $cred['password']);
        }

        // setup process timeout
        ProcessExecutor::setTimeout((int) $config->get('process-timeout'));
    }
public function loadConfiguration(Config $config)
    {
        $bitbucketOauth = $config->get('bitbucket-oauth') ?: array();
        $githubOauth = $config->get('github-oauth') ?: array();
        $gitlabOauth = $config->get('gitlab-oauth') ?: array();
        $gitlabToken = $config->get('gitlab-token') ?: array();
        $httpBasic = $config->get('http-basic') ?: array();

        // reload oauth tokens from config if available

        foreach ($bitbucketOauth as $domain => $cred) {
            $this->checkAndSetAuthentication($domain, $cred['consumer-key'], $cred['consumer-secret']);
        }

        foreach ($githubOauth as $domain => $token) {
            if (!preg_match('{^[.a-z0-9]+$}', $token)) {
                throw new \UnexpectedValueException('Your github oauth token for '.$domain.' contains invalid characters: "'.$token.'"');
            }
            $this->checkAndSetAuthentication($domain, $token, 'x-oauth-basic');
        }

        foreach ($gitlabOauth as $domain => $token) {
            $this->checkAndSetAuthentication($domain, $token, 'oauth2');
        }

        foreach ($gitlabToken as $domain => $token) {
            $this->checkAndSetAuthentication($domain, $token, 'private-token');
        }

        // reload http basic credentials from config if available
        foreach ($httpBasic as $domain => $cred) {
            $this->checkAndSetAuthentication($domain, $cred['username'], $cred['password']);
        }

        // setup process timeout
        ProcessExecutor::setTimeout((int) $config->get('process-timeout'));
    }
public function loadConfiguration ( Config $ config ) { $ bitbucketOauth = $ config -> get ( 'bitbucket-oauth' ) ? : array ( ) ; $ githubOauth = $ config -> get ( 'github-oauth' ) ? : array ( ) ; $ gitlabOauth = $ config -> get ( 'gitlab-oauth' ) ? : array ( ) ; $ gitlabToken = $ config -> get ( 'gitlab-token' ) ? : array ( ) ; $ httpBasic = $ config -> get ( 'http-basic' ) ? : array ( ) ; // reload oauth tokens from config if available foreach ( $ bitbucketOauth as $ domain => $ cred ) { $ this -> checkAndSetAuthentication ( $ domain , $ cred [ 'consumer-key' ] , $ cred [ 'consumer-secret' ] ) ; } foreach ( $ githubOauth as $ domain => $ token ) { if ( ! preg_match ( '{^[.a-z0-9]+$}' , $ token ) ) { throw new \ UnexpectedValueException ( 'Your github oauth token for ' . $ domain . ' contains invalid characters: "' . $ token . '"' ) ; } $ this -> checkAndSetAuthentication ( $ domain , $ token , 'x-oauth-basic' ) ; } foreach ( $ gitlabOauth as $ domain => $ token ) { $ this -> checkAndSetAuthentication ( $ domain , $ token , 'oauth2' ) ; } foreach ( $ gitlabToken as $ domain => $ token ) { $ this -> checkAndSetAuthentication ( $ domain , $ token , 'private-token' ) ; } // reload http basic credentials from config if available foreach ( $ httpBasic as $ domain => $ cred ) { $ this -> checkAndSetAuthentication ( $ domain , $ cred [ 'username' ] , $ cred [ 'password' ] ) ; } // setup process timeout ProcessExecutor :: setTimeout ( ( int ) $ config -> get ( 'process-timeout' ) ) ; }
{@inheritDoc}
{