Files
oauth2-server/src/Oauth2/Client/Token.php
Alex Bilbie 3ee5f22a55 Class rename
2012-09-04 12:30:15 +01:00

66 lines
1.1 KiB
PHP
Executable File

<?php
namespace Oauth2\Client;
/**
* OAuth2 Token
*
* @package OAuth2
* @category Token
* @author Phil Sturgeon
* @copyright (c) 2011 HappyNinjas Ltd
*/
abstract class Token
{
/**
* Create a new token object.
*
* $token = OAuth2_Token::factory($name);
*
* @param string token type
* @param array token options
* @return Token
*/
public static function factory($name = 'access', array $options = null)
{
$name = ucfirst(strtolower($name));
include_once 'Token/'.$name.'.php';
$class = $name.'Token';
return new $class($options);
}
/**
* Return the value of any protected class variable.
*
* // Get the token secret
* $secret = $token->secret;
*
* @param string variable name
* @return mixed
*/
public function __get($key)
{
return $this->$key;
}
/**
* Return a boolean if the property is set
*
* // Get the token secret
* if ($token->secret) exit('YAY SECRET');
*
* @param string variable name
* @return bool
*/
public function __isset($key)
{
return isset($this->$key);
}
} // End Token