web/lib/Zend/Service/WindowsAzure/Storage.php
changeset 807 877f952ae2bd
parent 207 621fa6caec0c
child 1230 68c69c656a2c
--- a/web/lib/Zend/Service/WindowsAzure/Storage.php	Thu Mar 21 17:31:31 2013 +0100
+++ b/web/lib/Zend/Service/WindowsAzure/Storage.php	Thu Mar 21 19:50:53 2013 +0100
@@ -15,15 +15,15 @@
  * @category   Zend
  * @package    Zend_Service_WindowsAzure
  * @subpackage Storage
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id: Storage.php 23167 2010-10-19 17:53:31Z mabe $
+ * @version    $Id: Storage.php 24697 2012-03-23 13:11:04Z ezimuel $
  */
 
 /**
- * @see Zend_Service_WindowsAzure_Credentials_CredentialsAbstract
+ * @see Zend_Http_Client
  */
-require_once 'Zend/Service/WindowsAzure/Credentials/CredentialsAbstract.php';
+require_once 'Zend/Http/Client.php';
 
 /**
  * @see Zend_Service_WindowsAzure_Credentials_SharedKey
@@ -34,27 +34,11 @@
  * @see Zend_Service_WindowsAzure_RetryPolicy_RetryPolicyAbstract
  */
 require_once 'Zend/Service/WindowsAzure/RetryPolicy/RetryPolicyAbstract.php';
-
-/**
- * @see Zend_Service_WindowsAzure_Exception
- */
-require_once 'Zend/Service/WindowsAzure/Exception.php';
-
-/**
- * @see Zend_Http_Client
- */
-require_once 'Zend/Http/Client.php';
-
-/**
- * @see Zend_Http_Response
- */
-require_once 'Zend/Http/Response.php';
-
 /**
  * @category   Zend
  * @package    Zend_Service_WindowsAzure
  * @subpackage Storage
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  */
 class Zend_Service_WindowsAzure_Storage
@@ -205,13 +189,13 @@
 			$this->_usePathStyleUri = true;
 		}
 		
-		if ($this->_credentials === null) {
+		if (is_null($this->_credentials)) {
 		    $this->_credentials = new Zend_Service_WindowsAzure_Credentials_SharedKey(
 		    	$this->_accountName, $this->_accountKey, $this->_usePathStyleUri);
 		}
 		
 		$this->_retryPolicy = $retryPolicy;
-		if ($this->_retryPolicy === null) {
+		if (is_null($this->_retryPolicy)) {
 		    $this->_retryPolicy = Zend_Service_WindowsAzure_RetryPolicy_RetryPolicyAbstract::noRetry();
 		}
 		
@@ -238,7 +222,7 @@
 	{
 		$this->_httpClientChannel->setAdapter($adapterInstance);
 	}
-
+	
     /**
      * Retrieve HTTP client channel
      * 
@@ -257,7 +241,7 @@
 	public function setRetryPolicy(Zend_Service_WindowsAzure_RetryPolicy_RetryPolicyAbstract $retryPolicy = null)
 	{
 		$this->_retryPolicy = $retryPolicy;
-		if ($this->_retryPolicy === null) {
+		if (is_null($this->_retryPolicy)) {
 		    $this->_retryPolicy = Zend_Service_WindowsAzure_RetryPolicy_RetryPolicyAbstract::noRetry();
 		}
 	}
@@ -372,7 +356,7 @@
 		}
 			
 		// Clean headers
-		if ($headers === null) {
+		if (is_null($headers)) {
 		    $headers = array();
 		}
 		
@@ -397,7 +381,7 @@
 		$requestHeaders = $this->_credentials
 						  ->signRequestHeaders($httpVerb, $path, $queryString, $headers, $forTableStorage, $resourceType, $requiredPermission, $rawData);
 
-		// Prepare request
+		// Prepare request 
 		$this->_httpClientChannel->resetParameters(true);
 		$this->_httpClientChannel->setUri($requestUrl);
 		$this->_httpClientChannel->setHeaders($requestHeaders);
@@ -421,7 +405,8 @@
 	 */
 	protected function _parseResponse(Zend_Http_Response $response = null)
 	{
-		if ($response === null) {
+		if (is_null($response)) {
+			require_once 'Zend/Service/WindowsAzure/Exception.php';
 			throw new Zend_Service_WindowsAzure_Exception('Response should not be null.');
 		}
 		
@@ -459,11 +444,13 @@
 		$headers = array();
 		foreach ($metadata as $key => $value) {
 			if (strpos($value, "\r") !== false || strpos($value, "\n") !== false) {
-				throw new Zend_Service_WindowsAzure_Exception('Metadata cannot contain newline characters.');
+                            require_once 'Zend/Service/WindowsAzure/Exception.php';
+                            throw new Zend_Service_WindowsAzure_Exception('Metadata cannot contain newline characters.');
 			}
 			
 			if (!self::isValidMetadataName($key)) {
-		    	throw new Zend_Service_WindowsAzure_Exception('Metadata name does not adhere to metadata naming conventions. See http://msdn.microsoft.com/en-us/library/aa664670(VS.71).aspx for more information.');
+                            require_once 'Zend/Service/WindowsAzure/Exception.php';
+                            throw new Zend_Service_WindowsAzure_Exception('Metadata name does not adhere to metadata naming conventions. See http://msdn.microsoft.com/en-us/library/aa664670(VS.71).aspx for more information.');
 			}
 			
 		    $headers["x-ms-meta-" . strtolower($key)] = $value;
@@ -503,7 +490,7 @@
 	protected function _parseMetadataElement($element = null)
 	{
 		// Metadata present?
-		if ($element !== null && isset($element->Metadata) && $element->Metadata !== null) {
+		if (!is_null($element) && isset($element->Metadata) && !is_null($element->Metadata)) {
 			return get_object_vars($element->Metadata);
 		}
 
@@ -521,7 +508,7 @@
 	    $tz = @date_default_timezone_get();
 	    @date_default_timezone_set('UTC');
 	    
-	    if ($timestamp === null) {
+	    if (is_null($timestamp)) {
 	        $timestamp = time();
 	    }