[ZF-10089] Zend_Log
[zend/radio.git] / library / Zend / Oauth.php
blobd0ffca1a072fb4ee97248d187b88a610f3b75c21
1 <?php
2 /**
3 * Zend Framework
5 * LICENSE
7 * This source file is subject to the new BSD license that is bundled
8 * with this package in the file LICENSE.txt.
9 * It is also available through the world-wide-web at this URL:
10 * http://framework.zend.com/license/new-bsd
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@zend.com so we can send you a copy immediately.
15 * @category Zend
16 * @package Zend_Oauth
17 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18 * @license http://framework.zend.com/license/new-bsd New BSD License
19 * @version $Id$
22 /** Zend_Http_Client */
23 require_once 'Zend/Http/Client.php';
25 /**
26 * @category Zend
27 * @package Zend_Oauth
28 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
29 * @license http://framework.zend.com/license/new-bsd New BSD License
31 class Zend_Oauth
33 const REQUEST_SCHEME_HEADER = 'header';
34 const REQUEST_SCHEME_POSTBODY = 'postbody';
35 const REQUEST_SCHEME_QUERYSTRING = 'querystring';
36 const GET = 'GET';
37 const POST = 'POST';
38 const PUT = 'PUT';
39 const DELETE = 'DELETE';
40 const HEAD = 'HEAD';
42 /**
43 * Singleton instance if required of the HTTP client
45 * @var Zend_Http_Client
47 protected static $httpClient = null;
49 /**
50 * Allows the external environment to make Zend_Oauth use a specific
51 * Client instance.
53 * @param Zend_Http_Client $httpClient
54 * @return void
56 public static function setHttpClient(Zend_Http_Client $httpClient)
58 self::$httpClient = $httpClient;
61 /**
62 * Return the singleton instance of the HTTP Client. Note that
63 * the instance is reset and cleared of previous parameters and
64 * Authorization header values.
66 * @return Zend_Http_Client
68 public static function getHttpClient()
70 if (!isset(self::$httpClient)) {
71 self::$httpClient = new Zend_Http_Client;
72 } else {
73 self::$httpClient->setHeaders('Authorization', null);
74 self::$httpClient->resetParameters();
76 return self::$httpClient;
79 /**
80 * Simple mechanism to delete the entire singleton HTTP Client instance
81 * which forces an new instantiation for subsequent requests.
83 * @return void
85 public static function clearHttpClient()
87 self::$httpClient = null;