original_string: public function authenticate($username, $password)
      {
          $authRequest = new Request('GET', $this->userbaseUrl);
          $client = new GuzzleClient(
              [
                  'verify' => $this->tlsCertVerification,
                  'headers' => [
                      'User-Agent' => 'HubUserbaseClient (Guzzle)',
                  ],
                  'auth' => [$username, $password],
              ]
          );
          try {
              $response = $client->send($authRequest);
          } catch (BadResponseException $e) {
              $this->handleBadResponseException($e);
          } catch (GuzzleException $e) {
              throw new AuthenticationFailureException(
                  null,
                  "The authentication request failed unexpectedly.",
                  null,
                  $e
              );
          }
          $json = $this->getResponseData($response);
          if (!$json) {
              throw new AuthenticationFailureException(
                  $response,
                  "Authentication failed because the authentication request did not result in the expected response data."
              );
          }
          if (!isset($json['jwt'])) {
              throw new AuthenticationFailureException(
                  $response,
                  "Authentication failed because an authentication token was not obtained."
              );
          }
          return $json['jwt'];
      }
code: public function authenticate($username, $password)
      {
          $authRequest = new Request('GET', $this->userbaseUrl);
          $client = new GuzzleClient(
              [
                  'verify' => $this->tlsCertVerification,
                  'headers' => [
                      'User-Agent' => 'HubUserbaseClient (Guzzle)',
                  ],
                  'auth' => [$username, $password],
              ]
          );
          try {
              $response = $client->send($authRequest);
          } catch (BadResponseException $e) {
              $this->handleBadResponseException($e);
          } catch (GuzzleException $e) {
              throw new AuthenticationFailureException(
                  null,
                  "The authentication request failed unexpectedly.",
                  null,
                  $e
              );
          }
          $json = $this->getResponseData($response);
          if (!$json) {
              throw new AuthenticationFailureException(
                  $response,
                  "Authentication failed because the authentication request did not result in the expected response data."
              );
          }
          if (!isset($json['jwt'])) {
              throw new AuthenticationFailureException(
                  $response,
                  "Authentication failed because an authentication token was not obtained."
              );
          }
          return $json['jwt'];
      }
code_tokens: public function authenticate ( $ username , $ password ) { $ authRequest = new Request ( 'GET' , $ this -> userbaseUrl ) ; $ client = new GuzzleClient ( [ 'verify' => $ this -> tlsCertVerification , 'headers' => [ 'User-Agent' => 'HubUserbaseClient (Guzzle)' , ] , 'auth' => [ $ username , $ password ] , ] ) ; try { $ response = $ client -> send ( $ authRequest ) ; } catch ( BadResponseException $ e ) { $ this -> handleBadResponseException ( $ e ) ; } catch ( GuzzleException $ e ) { throw new AuthenticationFailureException ( null , "The authentication request failed unexpectedly." , null , $ e ) ; } $ json = $ this -> getResponseData ( $ response ) ; if ( ! $ json ) { throw new AuthenticationFailureException ( $ response , "Authentication failed because the authentication request did not result in the expected response data." ) ; } if ( ! isset ( $ json [ 'jwt' ] ) ) { throw new AuthenticationFailureException ( $ response , "Authentication failed because an authentication token was not obtained." ) ; } return $ json [ 'jwt' ] ; }
docstring: Authenticate with UserBase.
  
  The credentials given here will be used to request a Json Web Token,
  claiming the username, from UserBase.
  
  @param string $username
  @param string $password
  
  @return string
  
  @throws \Hub\Client\Exception\AuthenticationFailureException
docstring_tokens: Authenticate with UserBase .