Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.10.x will end 8 November 2021 (12 months).
  • Bug fixes for security issues in 3.10.x will end 9 May 2022 (18 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

Differences Between: [Versions 310 and 402] [Versions 310 and 403]

   1  <?php
   2  
   3  namespace IMSGlobal\LTI\OAuth;
   4  
   5  /**
   6   * Class to represent an %OAuth Token
   7   *
   8   * @copyright  Andy Smith
   9   * @version 2008-08-04
  10   * @license https://opensource.org/licenses/MIT The MIT License
  11   */
  12  class OAuthToken {
  13  
  14      // access tokens and request tokens
  15      public $key;
  16      public $secret;
  17  
  18      /**
  19       * key = the token
  20       * secret = the token secret
  21       */
  22      function __construct($key, $secret) {
  23          $this->key = $key;
  24          $this->secret = $secret;
  25      }
  26  
  27      /**
  28       * generates the basic string serialization of a token that a server
  29       * would respond to request_token and access_token calls with
  30       */
  31      function to_string() {
  32          return 'oauth_token=' .
  33                 OAuthUtil::urlencode_rfc3986($this->key) .
  34                 '&oauth_token_secret=' .
  35                 OAuthUtil::urlencode_rfc3986($this->secret);
  36      }
  37  
  38      function __toString() {
  39          return $this->to_string();
  40      }
  41  
  42  }