2012-11-17 21:13:44 +00:00
|
|
|
<?php
|
2012-11-21 11:10:57 +00:00
|
|
|
/**
|
|
|
|
* OAuth
|
|
|
|
*
|
|
|
|
* @package OAuth
|
|
|
|
* @author Andy Smith
|
|
|
|
* @author Gary Jones <gary@garyjones.co.uk>
|
|
|
|
* @license https://raw.github.com/GaryJones/OAuth/master/LICENSE MIT
|
|
|
|
* @link https://github.com/GaryJones/OAuth
|
|
|
|
*/
|
|
|
|
|
2012-11-17 21:13:44 +00:00
|
|
|
namespace GaryJones\OAuth;
|
|
|
|
|
2012-11-21 11:10:57 +00:00
|
|
|
/**
|
|
|
|
* Client holds the properties of a single client / consumer.
|
|
|
|
*
|
|
|
|
* @package OAuth
|
|
|
|
* @author Gary Jones <gary@garyjones.co.uk>
|
|
|
|
*/
|
|
|
|
class Client extends Credential
|
2012-11-17 21:13:44 +00:00
|
|
|
{
|
2012-11-22 13:17:23 +00:00
|
|
|
/**
|
|
|
|
* URL to which authorized requests will redirect to.
|
|
|
|
*
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
protected $callback_url;
|
|
|
|
|
2012-11-21 11:10:57 +00:00
|
|
|
/**
|
|
|
|
* Constructs a new client object and populates the required parameters.
|
|
|
|
*
|
|
|
|
* @param string $key Client key / identifier.
|
|
|
|
* @param string $secret Client shared-secret.
|
|
|
|
* @param string $callback_url URL to which authorized request will redirect to.
|
|
|
|
*/
|
2012-11-17 21:13:44 +00:00
|
|
|
public function __construct($key, $secret, $callback_url = null)
|
|
|
|
{
|
2012-11-21 11:10:57 +00:00
|
|
|
$this->setKey($key);
|
|
|
|
$this->setSecret($secret);
|
2012-11-22 13:17:23 +00:00
|
|
|
$this->setCallbackUrl($callback_url);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the callback URL.
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function getCallbackUrl()
|
|
|
|
{
|
|
|
|
return $this->callback_url;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the callbackURL
|
|
|
|
*
|
|
|
|
* @param string $callback_url
|
|
|
|
*/
|
|
|
|
public function setCallbackUrl($callback_url)
|
|
|
|
{
|
2012-11-17 21:13:44 +00:00
|
|
|
$this->callback_url = $callback_url;
|
|
|
|
}
|
|
|
|
}
|