1 | <?php |
||
12 | class Request |
||
13 | { |
||
14 | public $parameters; |
||
15 | |||
16 | public $http_method; |
||
17 | |||
18 | public $http_url; |
||
19 | |||
20 | public function __construct($http_method, $http_url, $parameters = null) |
||
30 | |||
31 | /** |
||
32 | * @param Consumer $consumer |
||
33 | * @param Token $token |
||
34 | * @param string $method |
||
35 | * @param string $url |
||
36 | * @param array $parameters |
||
37 | * @return Request |
||
38 | */ |
||
39 | public static function fromConsumerAndToken(Consumer $consumer, Token $token, $method, $url, array $parameters = array()) |
||
55 | |||
56 | public function setParameter($name, $value, $allow_duplicates = true) |
||
73 | |||
74 | /** |
||
75 | * The request parameters, sorted and concatenated into a normalized string. |
||
76 | * |
||
77 | * @return string |
||
78 | */ |
||
79 | public function getSignableParameters() |
||
92 | |||
93 | /** |
||
94 | * Returns the base string of this request |
||
95 | * |
||
96 | * The base string defined as the method, the url |
||
97 | * and the parameters (normalized), each urlencoded |
||
98 | * and the concated with &. |
||
99 | * |
||
100 | * @return string |
||
101 | */ |
||
102 | public function getSignatureBaseString() |
||
114 | |||
115 | /** |
||
116 | * just uppercases the http method |
||
117 | */ |
||
118 | public function getNormalizedHttpMethod() |
||
122 | |||
123 | /** |
||
124 | * parses the url and rebuilds it to be |
||
125 | * scheme://host/path |
||
126 | */ |
||
127 | public function getNormalizedHttpUrl() |
||
142 | |||
143 | /** |
||
144 | * builds a url usable for a GET request |
||
145 | */ |
||
146 | public function toUrl() |
||
157 | |||
158 | /** |
||
159 | * builds the data one would send in a POST request |
||
160 | */ |
||
161 | public function toPostData() |
||
165 | |||
166 | /** |
||
167 | * builds the Authorization: header |
||
168 | * @param mixed $realm |
||
169 | * @return array |
||
170 | */ |
||
171 | public function toHeader($realm = null) |
||
198 | |||
199 | public function __toString() |
||
203 | |||
204 | /** |
||
205 | * @param AbstractSignatureMethod $signatureMethod |
||
206 | * @param Consumer $consumer |
||
207 | * @param Token $token |
||
208 | */ |
||
209 | public function signRequest(AbstractSignatureMethod $signatureMethod, Consumer $consumer, Token $token) |
||
216 | |||
217 | /** |
||
218 | * util function: current nonce |
||
219 | */ |
||
220 | private static function generateNonce() |
||
224 | } |
||
225 |