Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
10582 lgm 1
<?php
2
/**
3
 * OAuth2 Token
4
 *
5
 * @package    OAuth2
6
 * @category   Token
7
 * @author     Phil Sturgeon
8
 * @copyright  (c) 2011 HappyNinjas Ltd
9
 */
10
 
11
class OAuth2_Token_Authorize extends OAuth2_Token
12
{
13
	/**
14
	 * @var  string  code
15
	 */
16
	protected $code;
17
 
18
	/**
19
	 * @var  string  redirect_uri
20
	 */
21
	protected $redirect_uri;
22
 
23
	/**
24
	 * Sets the token, expiry, etc values.
25
	 *
26
	 * @param   array   token options
27
	 * @return  void
28
	 */
29
 
30
	public function __construct(array $options)
31
	{
32
		if ( ! isset($options['code']))
33
	    {
34
            throw new Exception('Required option not passed: code');
35
        }
36
 
37
        elseif ( ! isset($options['redirect_uri']))
38
        {
39
            throw new Exception('Required option not passed: redirect_uri');
40
        }
41
 
42
		$this->code = $options['code'];
43
		$this->redirect_uri = $options['redirect_uri'];
44
	}
45
 
46
	/**
47
	 * Returns the token key.
48
	 *
49
	 * @return  string
50
	 */
51
	public function __toString()
52
	{
53
		return (string) $this->code;
54
	}
55
 
56
} // End OAuth2_Token_Access