aboutsummaryrefslogtreecommitdiff
path: root/vendor/eher/oauth/src/Eher/OAuth/Token.php
blob: e1d9f65b2c63c7778b5d45d28bf1e5955b187a21 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php

namespace Eher\OAuth;

class Token {
  // access tokens and request tokens
  public $key;
  public $secret;

  /**
   * key = the token
   * secret = the token secret
   */
  function __construct($key, $secret) {
    $this->key = $key;
    $this->secret = $secret;
  }

  /**
   * generates the basic string serialization of a token that a server
   * would respond to request_token and access_token calls with
   */
  function to_string() {
    return "oauth_token=" .
           Util::urlencode_rfc3986($this->key) .
           "&oauth_token_secret=" .
           Util::urlencode_rfc3986($this->secret);
  }

  function __toString() {
    return $this->to_string();
  }
}