/stubs/oauth.php

https://github.com/FractalizeR/php-stubs · PHP · 357 lines · 79 code · 56 blank · 222 comment · 0 complexity · b8d98ebc0499adb4929c80246e1a3874 MD5 · raw file

  1. <?php
  2. define('OAUTH_SIG_METHOD_RSASHA1', 'RSA-SHA1');
  3. define('OAUTH_SIG_METHOD_HMACSHA1', 'HMAC-SHA1');
  4. define('OAUTH_SIG_METHOD_HMACSHA256', 'HMAC-SHA256');
  5. define('OAUTH_AUTH_TYPE_AUTHORIZATION', 3);
  6. define('OAUTH_AUTH_TYPE_NONE', 2);
  7. define('OAUTH_AUTH_TYPE_URI', 1);
  8. define('OAUTH_AUTH_TYPE_FORM', 2);
  9. define('OAUTH_HTTP_METHOD_GET', 'GET');
  10. define('OAUTH_HTTP_METHOD_POST', 'POST');
  11. define('OAUTH_HTTP_METHOD_PUT', 'PUT');
  12. define('OAUTH_HTTP_METHOD_HEAD', 'HEAD');
  13. define('OAUTH_HTTP_METHOD_DELETE', 'DELETE');
  14. define('OAUTH_REQENGINE_STREAMS', 1);
  15. define('OAUTH_REQENGINE_CURL', 2);
  16. define('OAUTH_OK', 0);
  17. define('OAUTH_BAD_NONCE', 4);
  18. define('OAUTH_BAD_TIMESTAMP', 8);
  19. define('OAUTH_CONSUMER_KEY_UNKNOWN', 16);
  20. define('OAUTH_CONSUMER_KEY_REFUSED', 32);
  21. define('OAUTH_INVALID_SIGNATURE', 64);
  22. define('OAUTH_TOKEN_USED', 128);
  23. define('OAUTH_TOKEN_EXPIRED', 256);
  24. define('OAUTH_TOKEN_REJECTED', 1024);
  25. define('OAUTH_VERIFIER_INVALID', 2048);
  26. define('OAUTH_PARAMETER_ABSENT', 4096);
  27. define('OAUTH_SIGNATURE_METHOD_REJECTED', 8192);
  28. /**
  29. * Generate a Signature Base String
  30. *
  31. * @param string $http_method
  32. * @param string $uri
  33. * @param array $request_parameters
  34. * @return string
  35. */
  36. function oauth_get_sbs($http_method, $uri, $request_parameters = array()) { }
  37. /**
  38. * Encode a URI to RFC 3986
  39. *
  40. * @param string $uri
  41. * @return string
  42. */
  43. function oauth_urlencode($uri) { }
  44. /**
  45. * The OAuth extension provides a simple interface to interact with data providers using the OAuth HTTP specification to protect private resources.
  46. */
  47. class OAuth {
  48. /**
  49. * @var bool
  50. */
  51. public $debug;
  52. /**
  53. * @var bool
  54. */
  55. public $sslChecks;
  56. /**
  57. * @var array
  58. */
  59. public $debugInfo;
  60. /**
  61. * Create a new OAuth object
  62. * @param string $consumer_key
  63. * @param string $consumer_secret
  64. * @param string $signature_method
  65. * @param int $auth_type
  66. */
  67. public function __construct($consumer_key, $consumer_secret, $signature_method = OAUTH_SIG_METHOD_HMACSHA1, $auth_type = OAUTH_AUTH_TYPE_AUTHORIZATION) { }
  68. /**
  69. * Turn off verbose debugging
  70. * @return bool
  71. */
  72. public function disableDebug() { }
  73. /**
  74. * Turn off redirects
  75. * @return void
  76. */
  77. public function disableRedirects() { }
  78. /**
  79. * Turn off SSL checks
  80. * @return bool
  81. */
  82. public function disableSSLChecks() { }
  83. /**
  84. * Turn on verbose debugging
  85. * @return bool
  86. */
  87. public function enableDebug() { }
  88. /**
  89. * Turn on redirects
  90. * @return bool
  91. */
  92. public function enableRedirects() { }
  93. /**
  94. * Turn on SSL checks
  95. * @return bool
  96. */
  97. public function enableSSLChecks() { }
  98. /**
  99. * Set the timeout
  100. * @param int $timeout Time in milliseconds
  101. * @return void
  102. */
  103. public function setTimeout($timeout) { }
  104. /**
  105. * Fetch an OAuth-protected resource
  106. * @param string $protected_resource_url
  107. * @param array $extra_parameters
  108. * @param string $http_method
  109. * @param array $http_headers
  110. * @return mixed
  111. */
  112. public function fetch($protected_resource_url, $extra_parameters = array(), $http_method = null, $http_headers = array()) { }
  113. /**
  114. * Fetch an access token
  115. * @param string $access_token_url
  116. * @param string $auth_session_handle
  117. * @param string $verifier_token
  118. * @return array
  119. */
  120. public function getAccessToken($access_token_url, $auth_session_handle = null, $verifier_token = null) { }
  121. /**
  122. * Get CA information
  123. * @return array
  124. */
  125. public function getCAPath() { }
  126. /**
  127. * Get the last response
  128. * @return string
  129. */
  130. public function getLastResponse() { }
  131. /**
  132. * Get HTTP information about the last response
  133. * @return array
  134. */
  135. public function getLastResponseInfo() { }
  136. /**
  137. * Fetch a request token
  138. * @param string $request_token_url
  139. * @param string $callback_url
  140. * @return array
  141. */
  142. public function getRequestToken($request_token_url, $callback_url = null) { }
  143. /**
  144. * Set authorization type
  145. * @param int $auth_type
  146. * @return mixed
  147. */
  148. public function setAuthType(int $auth_type) { }
  149. /**
  150. * Set CA path and info
  151. * @param string $ca_path
  152. * @param string $ca_info
  153. * @return mixed
  154. */
  155. public function setCAPath($ca_path = null, $ca_info = null) { }
  156. /**
  157. * Set the nonce for subsequent requests
  158. * @param string $nonce
  159. * @return mixed
  160. */
  161. public function setNonce($nonce) { }
  162. /**
  163. *
  164. * @param int $reqengine
  165. * @return void
  166. */
  167. public function setRequestEngine($reqengine) { }
  168. /**
  169. * Set the RSA certificate
  170. * @param string $cert
  171. * @return mixed
  172. */
  173. public function setRSACertificate($cert) { }
  174. /**
  175. * Set the timestamp
  176. * @param string $timestamp
  177. * @return mixed
  178. */
  179. public function setTimestamp($timestamp) { }
  180. /**
  181. * Set the token and secret
  182. * @param string $token
  183. * @param string $token_secret
  184. * @return bool
  185. */
  186. public function setToken($token, $token_secret) { }
  187. /**
  188. * Set the OAuth version
  189. * @param string $version
  190. * @return bool
  191. */
  192. public function setVersion($version) { }
  193. }
  194. /**
  195. *
  196. */
  197. class OAuthException extends Exception {
  198. /**
  199. * The response of the exception which occurred, if any
  200. * @var string
  201. */
  202. public $lastResponse;
  203. /**
  204. * @var array
  205. */
  206. public $debugInfo;
  207. }
  208. ;
  209. /**
  210. * Manages an OAuth provider class.
  211. */
  212. class OAuthProvider {
  213. /**
  214. * @param string $req_params
  215. * @return bool
  216. */
  217. final public function addRequiredParameter($req_params) { }
  218. /**
  219. * @return void
  220. */
  221. public function callconsumerHandler() { }
  222. /**
  223. * @return void
  224. */
  225. public function callTimestampNonceHandler() { }
  226. /**
  227. * @return void
  228. */
  229. public function calltokenHandler() { }
  230. /**
  231. * @param string $uri
  232. * @param string $method
  233. * @return void
  234. */
  235. public function checkOAuthRequest($uri = '', $method = '') { }
  236. /**
  237. * @param array $params_array
  238. * @return OAuthProvider
  239. */
  240. public function __construct($params_array) { }
  241. /**
  242. * @param callback $callback_function
  243. * @return void
  244. */
  245. public function consumerHandler($callback_function) { }
  246. /**
  247. * @param int $size
  248. * @param bool $strong
  249. * @return string
  250. * @static
  251. * @final
  252. */
  253. final public static function generateToken($size, $strong = false) { }
  254. /**
  255. * @param mixed $params_array
  256. * @return void
  257. */
  258. public function is2LeggedEndpoint($params_array) { }
  259. /**
  260. * @return bool $will_issue_request_token
  261. * @return void
  262. */
  263. public function isRequestTokenEndpoint($will_issue_request_token) { }
  264. /**
  265. * @param string
  266. * @return bool
  267. * @final
  268. */
  269. final public function removeRequiredParameter($req_params) { }
  270. /**
  271. * @param string $oauthexcecption
  272. * @param bool $send_headers
  273. * @static
  274. * @return string
  275. * @final
  276. */
  277. final public static function reportProblem($oauthexception, $send_headers = true) { }
  278. /**
  279. * @param string $param_key
  280. * @param mixed $param_val
  281. * @return bool
  282. * @final
  283. */
  284. final public function setParam($param_key, $param_val = null) { }
  285. /**
  286. * @param string $path
  287. * @return bool
  288. * @final
  289. */
  290. final public function setRequestTokenPath($path) { }
  291. /**
  292. * @param callback $callback_function
  293. * @return void
  294. */
  295. public function timestampNonceHandler($callback_function) { }
  296. /**
  297. * @param callback $callback_function
  298. * @return void
  299. */
  300. public function tokenHandler($callback_function) { }
  301. }