Permalink
Browse files

Completed comments on OAuth_Token classes

  • Loading branch information...
1 parent 381ca1c commit 8ecd318287406f53c327662190929cb318a20ff8 @shadowhand shadowhand committed Jun 27, 2010
Showing with 66 additions and 2 deletions.
  1. +35 −0 classes/oauth/token.php
  2. +9 −1 classes/oauth/token/access.php
  3. +22 −1 classes/oauth/token/request.php
@@ -10,17 +10,43 @@
*/
abstract class OAuth_Token {
+ /**
+ * Create a new token object.
+ *
+ * $token = OAuth_Token::factory($name);
+ *
+ * @param string token type
+ * @param array token options
+ * @return OAuth_Token
+ */
public static function factory($name, array $options = NULL)
{
$class = __CLASS__.'_'.$name;
return new $class($options);
}
+ /**
+ * @var string token type name: request, access
+ */
+ protected $name;
+
+ /**
+ * @var string token key
+ */
protected $token;
+ /**
+ * @var string token secret
+ */
protected $secret;
+ /**
+ * Sets the token and secret values.
+ *
+ * @param array token options
+ * @return void
+ */
public function __construct(array $options = NULL)
{
if ( ! isset($options['token']))
@@ -40,6 +66,15 @@ public function __construct(array $options = NULL)
$this->secret = $options['secret'];
}
+ /**
+ * 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;
@@ -1,5 +1,13 @@
<?php defined('SYSPATH') or die('No direct script access.');
-
+/**
+ * OAuth Access Token
+ *
+ * @package Kohana/OAuth
+ * @package Token
+ * @author Kohana Team
+ * @copyright (c) 2010 Kohana Team
+ * @license http://kohanaframework.org/license
+ */
class OAuth_Token_Access extends OAuth_Token {
protected $name = 'access';
@@ -1,14 +1,35 @@
<?php defined('SYSPATH') or die('No direct script access.');
-
+/**
+ * OAuth Request Token
+ *
+ * @package Kohana/OAuth
+ * @package Token
+ * @author Kohana Team
+ * @copyright (c) 2010 Kohana Team
+ * @license http://kohanaframework.org/license
+ */
class OAuth_Token_Request extends OAuth_Token {
protected $name = 'request';
+ /**
+ * @var string request token verifier
+ */
protected $verifier;
+ /**
+ * Change the token verifier.
+ *
+ * $token->verifier($key);
+ *
+ * @param string new verifier
+ * @return $this
+ */
public function verifier($verifier)
{
$this->verifier = $verifier;
+
+ return $this;
}
} // End OAuth_Token_Request

0 comments on commit 8ecd318

Please sign in to comment.