-
Notifications
You must be signed in to change notification settings - Fork 12
/
StripeOAuth2Client.class.php
82 lines (78 loc) · 2.34 KB
/
StripeOAuth2Client.class.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<?php
// dependecy checks
if (!class_exists('OAuth2Client')) {
throw new Exception(
'*OAuth2Client* is required. Please include it ' .
'(https://github.com/quizlet/oauth2-php) before using this library.'
);
}
/**
* StripeOAuth2Client
*
* Extends the <OAuth2Client> class to include a reference to the body of
* the last request that was made.
*
* Useful for Stripe, as it includes relevant information (eg. publisher
* key, user id, etc.) within the access-token request.
*
* Not sure if that's standard-practice, but this helps get around that
* caveat.
*
* Also, this is required anyway, since <quizlet>'s library is defined as
* abstract (https://github.com/quizlet/oauth2-php).
*
* @see <https://github.com/quizlet/oauth2-php>
* @see <https://code.google.com/p/oauth/>
* @thanks Eric Ma <[email protected]>
* @author Oliver Nassar <[email protected]>
* @extends OAuth2Client
*/
class StripeOAuth2Client extends OAuth2Client
{
/**
* _last
*
* The last response make, in raw form (eg. not json encoded, or
* anything).
*
* @var string
* @access private
*/
private $_last;
/**
* makeRequest
*
* See parent for full document of parameters. Extends the parent to
* store the last-made request locally.
*
* @access public
* @param string $path
* @param string $method (default: 'GET')
* @param array $params (default: Array)
* @param mixed $ch (default: NULL)
* @return string
*/
protected function makeRequest(
$path,
$method = 'GET',
$params = array(),
$ch = NULL
) {
$args = func_get_args();
$body = call_user_func_array(array('parent', 'makeRequest'), $args);
$this->_last = $body;
return $body;
}
/**
* getLastResponse
*
* Getter for the last response made.
*
* @access public
* @return string
*/
public function getLastResponse()
{
return $this->_last;
}
}