45 lines
893 B
PHP
45 lines
893 B
PHP
<?php
|
|
namespace GaryJones\OAuth;
|
|
|
|
class Token
|
|
{
|
|
// access tokens and request tokens
|
|
protected $key;
|
|
protected $secret;
|
|
|
|
/**
|
|
* key = the token
|
|
* secret = the token secret
|
|
*/
|
|
public function __construct($key, $secret)
|
|
{
|
|
$this->key = $key;
|
|
$this->secret = $secret;
|
|
}
|
|
|
|
public function getKey()
|
|
{
|
|
return $this->key;
|
|
}
|
|
|
|
public function getSecret()
|
|
{
|
|
return $this->secret;
|
|
}
|
|
|
|
/**
|
|
* generates the basic string serialization of a token that a server
|
|
* would respond to request_token and access_token calls with
|
|
*/
|
|
public function toString()
|
|
{
|
|
return 'oauth_token=' . Util::urlencodeRfc3986($this->key) .
|
|
'&oauth_token_secret=' . Util::urlencodeRfc3986($this->secret);
|
|
}
|
|
|
|
public function __toString()
|
|
{
|
|
return $this->toString();
|
|
}
|
|
}
|