original_string: function createOrRetrieveAuth(
          $username,
          $password,
          callable $enterPasswordCallback,
          $scopes,
          $note,
          $noteURL = "http://www.github.com/danack/GithubArtaxService",
          $maxAttempts = 3
      ) {
          $basicToken = new BasicAuthToken($username, $password);
          $otp = false;
  
          for ($i = 0; $i < $maxAttempts; $i++) {
              try {
                  $createAuthToken = $this->createAuthorization(
                      $basicToken->__toString(),
                      $scopes,
                      $note
                  );
  
                  $createAuthToken->setNote_url($noteURL);
                  if ($otp) {
                      $createAuthToken->setOtp($otp);
                  }
                  $authResult = $createAuthToken->execute();
  
                  return $authResult;
              }
              catch (OneTimePasswordAppException $otpae) {
                  $otp = $enterPasswordCallback(
                      "Please enter the code from your 2nd factor auth app:"
                  );
              }
              catch (OneTimePasswordSMSException $otse) {
                  $otp = $enterPasswordCallback(
                      "Please enter the code from the SMS Github should have sent you:"
                  );
              }
          }
  
          throw new GithubArtaxServiceException("Failed to create or retrieve oauth token.");
      }
code: function createOrRetrieveAuth(
          $username,
          $password,
          callable $enterPasswordCallback,
          $scopes,
          $note,
          $noteURL = "http://www.github.com/danack/GithubArtaxService",
          $maxAttempts = 3
      ) {
          $basicToken = new BasicAuthToken($username, $password);
          $otp = false;
  
          for ($i = 0; $i < $maxAttempts; $i++) {
              try {
                  $createAuthToken = $this->createAuthorization(
                      $basicToken->__toString(),
                      $scopes,
                      $note
                  );
  
                  $createAuthToken->setNote_url($noteURL);
                  if ($otp) {
                      $createAuthToken->setOtp($otp);
                  }
                  $authResult = $createAuthToken->execute();
  
                  return $authResult;
              }
              catch (OneTimePasswordAppException $otpae) {
                  $otp = $enterPasswordCallback(
                      "Please enter the code from your 2nd factor auth app:"
                  );
              }
              catch (OneTimePasswordSMSException $otse) {
                  $otp = $enterPasswordCallback(
                      "Please enter the code from the SMS Github should have sent you:"
                  );
              }
          }
  
          throw new GithubArtaxServiceException("Failed to create or retrieve oauth token.");
      }
code_tokens: function createOrRetrieveAuth ( $ username , $ password , callable $ enterPasswordCallback , $ scopes , $ note , $ noteURL = "http://www.github.com/danack/GithubArtaxService" , $ maxAttempts = 3 ) { $ basicToken = new BasicAuthToken ( $ username , $ password ) ; $ otp = false ; for ( $ i = 0 ; $ i < $ maxAttempts ; $ i ++ ) { try { $ createAuthToken = $ this -> createAuthorization ( $ basicToken -> __toString ( ) , $ scopes , $ note ) ; $ createAuthToken -> setNote_url ( $ noteURL ) ; if ( $ otp ) { $ createAuthToken -> setOtp ( $ otp ) ; } $ authResult = $ createAuthToken -> execute ( ) ; return $ authResult ; } catch ( OneTimePasswordAppException $ otpae ) { $ otp = $ enterPasswordCallback ( "Please enter the code from your 2nd factor auth app:" ) ; } catch ( OneTimePasswordSMSException $ otse ) { $ otp = $ enterPasswordCallback ( "Please enter the code from the SMS Github should have sent you:" ) ; } } throw new GithubArtaxServiceException ( "Failed to create or retrieve oauth token." ) ; }
docstring: Creates an Oauth token for a named application.
  
  @param $username string The username to create the oauth token for
  @param $password string The password of the user
  @param $enterPasswordCallback callable A callback to get the one-time password
  if the user has two factor auth enabled on their account.
  @param $scopes array The scopes/permissions that the token should
  have e.g. \GithubService\Github::SCOPE_USER_EMAIL and
  https://developer.github.com/v3/oauth/#scopes
  @param $applicationName string The name of the application
  @param $noteURL string The URL of application i.e. where a user should go to
  find help for the application.
  @param $maxAttempts int The maximum number of attempts. This only allows retries
  for the two-factor auth failing, not the password
  
  @return \GithubService\Model\OauthAccess
docstring_tokens: Creates an Oauth token for a named application .