src/Credentials/CredentialsProvider.php
public static function chain()
    {
        $providers = func_get_args();
        if (empty($providers)) {
            throw new \InvalidArgumentException('No providers in chain');
        }

        return function () use ($providers) {
            $provider = array_shift($providers);
            $credentials = $provider();

            while (($provider = array_shift($providers))
                && !($credentials instanceof Credentials)
            ) {
                $credentials = $provider();
            }
            return $credentials;
        };
    }
public static function chain()
    {
        $providers = func_get_args();
        if (empty($providers)) {
            throw new \InvalidArgumentException('No providers in chain');
        }

        return function () use ($providers) {
            $provider = array_shift($providers);
            $credentials = $provider();

            while (($provider = array_shift($providers))
                && !($credentials instanceof Credentials)
            ) {
                $credentials = $provider();
            }
            return $credentials;
        };
    }
public static function chain ( ) { $ providers = func_get_args ( ) ; if ( empty ( $ providers ) ) { throw new \ InvalidArgumentException ( 'No providers in chain' ) ; } return function ( ) use ( $ providers ) { $ provider = array_shift ( $ providers ) ; $ credentials = $ provider ( ) ; while ( ( $ provider = array_shift ( $ providers ) ) && ! ( $ credentials instanceof Credentials ) ) { $ credentials = $ provider ( ) ; } return $ credentials ; } ; }
Creates an aggregate credentials provider that invokes the provided
variadic providers one after the other until a provider returns
credentials

@return callable
@throws \InvalidArgumentException
Creates an aggregate credentials provider that invokes the provided variadic providers one after the other until a provider returns credentials