0
|
1 <?php
|
|
2 /**
|
|
3 * The MIT License
|
|
4 * Copyright (c) 2007 Andy Smith
|
|
5 */
|
|
6 namespace Abraham\TwitterOAuth;
|
|
7
|
|
8 class Token
|
|
9 {
|
|
10 /** @var string */
|
|
11 public $key;
|
|
12 /** @var string */
|
|
13 public $secret;
|
|
14
|
|
15 /**
|
|
16 * @param string $key The OAuth Token
|
|
17 * @param string $secret The OAuth Token Secret
|
|
18 */
|
|
19 public function __construct($key, $secret)
|
|
20 {
|
|
21 $this->key = $key;
|
|
22 $this->secret = $secret;
|
|
23 }
|
|
24
|
|
25 /**
|
|
26 * Generates the basic string serialization of a token that a server
|
|
27 * would respond to request_token and access_token calls with
|
|
28 *
|
|
29 * @return string
|
|
30 */
|
|
31 public function __toString()
|
|
32 {
|
|
33 return sprintf("oauth_token=%s&oauth_token_secret=%s",
|
|
34 Util::urlencodeRfc3986($this->key),
|
|
35 Util::urlencodeRfc3986($this->secret)
|
|
36 );
|
|
37 }
|
|
38 }
|