/**
  * Obtains the default FetchAuthTokenInterface implementation to use
  * in this environment.
  *
  * If supplied, $scope is used to in creating the credentials instance if
  * this does not fallback to the Compute Engine defaults.
  *
  * @param string|array scope the scope of the access request, expressed
  *   either as an Array or as a space-delimited String.
  *
  * @param $client GuzzleHttp\ClientInterface optional client.
  * @throws DomainException if no implementation can be obtained.
  */
 public static function getCredentials($scope = null, $client = null)
 {
     $creds = CredentialsLoader::fromEnv($scope);
     if (!is_null($creds)) {
         return $creds;
     }
     $creds = CredentialsLoader::fromWellKnownFile($scope);
     if (!is_null($creds)) {
         return $creds;
     }
     if (AppIdentityCredentials::onAppEngine()) {
         return new AppIdentityCredentials($scope);
     }
     if (GCECredentials::onGce($client)) {
         return new GCECredentials();
     }
     throw new \DomainException(self::notFound());
 }
 public function testIsTrueWhenServerSoftwareIsGoogleAppEngine()
 {
     $_SERVER['SERVER_SOFTWARE'] = 'Google App Engine';
     $this->assertTrue(AppIdentityCredentials::onAppEngine());
 }