Modules

Kohana_OAuth_Consumer

OAuth Consumer

package
Kohana/OAuth
category
Base
author
Kohana Team
copyright
© 2010 Kohana Team
license
http://kohanaframework.org/license
since
3.0.7

Class declared in MODPATH/oauth/classes/kohana/oauth/consumer.php on line 12.

Constants

  • None

Properties

Properties

protected string $callback

callback URL for OAuth authorization completion

protected string $key

consumer key

protected string $secret

consumer secret

Methods

public __construct( [ array $options = NULL ] ) (defined in Kohana_OAuth_Consumer)

Sets the consumer key and secret.

Parameters

  • array $options = NULL - Consumer options, key and secret are required

Return Values

  • void

Source Code

public function __construct(array $options = NULL)
{
	if ( ! isset($options['key']))
	{
		throw new Kohana_OAuth_Exception('Required option not passed: :option',
			array(':option' => 'key'));
	}

	if ( ! isset($options['secret']))
	{
		throw new Kohana_OAuth_Exception('Required option not passed: :option',
			array(':option' => 'secret'));
	}

	$this->key = $options['key'];

	$this->secret = $options['secret'];

	if (isset($options['callback']))
	{
		$this->callback = $options['callback'];
	}
}

public __get( string $key ) (defined in Kohana_OAuth_Consumer)

Return the value of any protected class variable.

// Get the consumer key
$key = $consumer->key;

Parameters

  • string $key required - Variable name

Return Values

  • mixed

Source Code

public function __get($key)
{
	return $this->$key;
}

public callback( string $callback ) (defined in Kohana_OAuth_Consumer)

Change the consumer callback.

Parameters

  • string $callback required - New consumer callback

Return Values

  • $this

Source Code

public function callback($callback)
{
	$this->callback = $callback;

	return $this;
}

public static factory( [ array $options = NULL ] ) (defined in Kohana_OAuth_Consumer)

Create a new consumer object.

$consumer = OAuth_Consumer::factory($options);

Parameters

  • array $options = NULL - Consumer options, key and secret are required

Return Values

  • OAuth_Consumer

Source Code

public static function factory(array $options = NULL)
{
	return new OAuth_Consumer($options);
}