Browse Source

ZF-10798 replacing tabs with spaces

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@23485 44c647ce-9c0f-0410-b52a-842ac1e357ba
mjh_ca 15 năm trước cách đây
mục cha
commit
fab2a2643a
62 tập tin đã thay đổi với 5203 bổ sung5203 xóa
  1. 3 3
      library/Zend/Application/Resource/Frontcontroller.php
  2. 4 4
      library/Zend/Application/Resource/Mail.php
  3. 1 1
      library/Zend/Application/Resource/Multidb.php
  4. 12 12
      library/Zend/Application/Resource/Useragent.php
  5. 2 2
      library/Zend/Auth/Adapter/Ldap.php
  6. 32 32
      library/Zend/Barcode/Object/Code128.php
  7. 17 17
      library/Zend/Captcha/Word.php
  8. 1 1
      library/Zend/Controller/Action.php
  9. 3 3
      library/Zend/Db/Adapter/Sqlsrv.php
  10. 6 6
      library/Zend/Db/Statement/Sqlsrv.php
  11. 8 8
      library/Zend/Feed/Writer.php
  12. 2 2
      library/Zend/Feed/Writer/Feed.php
  13. 1 1
      library/Zend/Http/Client/Adapter/Proxy.php
  14. 12 12
      library/Zend/Http/Client/Adapter/Socket.php
  15. 6 6
      library/Zend/Ldap.php
  16. 9 9
      library/Zend/Ldap/Attribute.php
  17. 30 30
      library/Zend/Ldap/Converter.php
  18. 1 1
      library/Zend/Log.php
  19. 2 2
      library/Zend/Log/Writer/Abstract.php
  20. 4 4
      library/Zend/Log/Writer/Mail.php
  21. 1 1
      library/Zend/Markup/Token.php
  22. 10 10
      library/Zend/Rest/Route.php
  23. 9 9
      library/Zend/Service/Amazon/Item.php
  24. 5 5
      library/Zend/Service/Amazon/S3.php
  25. 87 87
      library/Zend/Service/Amazon/SimpleDb.php
  26. 3 3
      library/Zend/Service/Amazon/SimpleDb/Attribute.php
  27. 202 202
      library/Zend/Service/WindowsAzure/Credentials/CredentialsAbstract.php
  28. 184 184
      library/Zend/Service/WindowsAzure/Credentials/SharedAccessSignature.php
  29. 129 129
      library/Zend/Service/WindowsAzure/Credentials/SharedKey.php
  30. 108 108
      library/Zend/Service/WindowsAzure/Credentials/SharedKeyLite.php
  31. 15 15
      library/Zend/Service/WindowsAzure/Diagnostics/ConfigurationDataSources.php
  32. 12 12
      library/Zend/Service/WindowsAzure/Diagnostics/ConfigurationDiagnosticInfrastructureLogs.php
  33. 27 27
      library/Zend/Service/WindowsAzure/Diagnostics/ConfigurationDirectories.php
  34. 166 166
      library/Zend/Service/WindowsAzure/Diagnostics/ConfigurationInstance.php
  35. 12 12
      library/Zend/Service/WindowsAzure/Diagnostics/ConfigurationLogs.php
  36. 26 26
      library/Zend/Service/WindowsAzure/Diagnostics/ConfigurationPerformanceCounters.php
  37. 28 28
      library/Zend/Service/WindowsAzure/Diagnostics/ConfigurationWindowsEventLog.php
  38. 12 12
      library/Zend/Service/WindowsAzure/Diagnostics/DirectoryConfigurationSubscription.php
  39. 1 1
      library/Zend/Service/WindowsAzure/Diagnostics/Exception.php
  40. 6 6
      library/Zend/Service/WindowsAzure/Diagnostics/LogLevel.php
  41. 136 136
      library/Zend/Service/WindowsAzure/Diagnostics/Manager.php
  42. 8 8
      library/Zend/Service/WindowsAzure/Diagnostics/PerformanceCounterSubscription.php
  43. 25 25
      library/Zend/Service/WindowsAzure/SessionHandler.php
  44. 461 461
      library/Zend/Service/WindowsAzure/Storage.php
  45. 82 82
      library/Zend/Service/WindowsAzure/Storage/Batch.php
  46. 75 75
      library/Zend/Service/WindowsAzure/Storage/BatchStorageAbstract.php
  47. 1908 1908
      library/Zend/Service/WindowsAzure/Storage/Blob.php
  48. 4 4
      library/Zend/Service/WindowsAzure/Storage/Blob/Stream.php
  49. 2 2
      library/Zend/Service/WindowsAzure/Storage/BlobInstance.php
  50. 2 2
      library/Zend/Service/WindowsAzure/Storage/DynamicTableEntity.php
  51. 3 3
      library/Zend/Service/WindowsAzure/Storage/LeaseInstance.php
  52. 2 2
      library/Zend/Service/WindowsAzure/Storage/PageRegionInstance.php
  53. 439 439
      library/Zend/Service/WindowsAzure/Storage/Queue.php
  54. 1 1
      library/Zend/Service/WindowsAzure/Storage/QueueInstance.php
  55. 4 4
      library/Zend/Service/WindowsAzure/Storage/QueueMessage.php
  56. 1 1
      library/Zend/Service/WindowsAzure/Storage/SignedIdentifier.php
  57. 512 512
      library/Zend/Service/WindowsAzure/Storage/Table.php
  58. 18 18
      library/Zend/Service/WindowsAzure/Storage/TableEntity.php
  59. 299 299
      library/Zend/Service/WindowsAzure/Storage/TableEntityQuery.php
  60. 2 2
      library/Zend/Service/WindowsAzure/Storage/TableInstance.php
  61. 9 9
      library/Zend/View/Helper/Doctype.php
  62. 11 11
      library/Zend/View/Helper/HeadMeta.php

+ 3 - 3
library/Zend/Application/Resource/Frontcontroller.php

@@ -101,9 +101,9 @@ class Zend_Application_Resource_Frontcontroller extends Zend_Application_Resourc
 
                 case 'plugins':
                     foreach ((array) $value as $pluginClass) {
-                    	$stackIndex = null;
-                    	if(is_array($pluginClass)) {
-                    	    $pluginClass = array_change_key_case($pluginClass, CASE_LOWER);
+                        $stackIndex = null;
+                        if(is_array($pluginClass)) {
+                            $pluginClass = array_change_key_case($pluginClass, CASE_LOWER);
                             if(isset($pluginClass['class']))
                             {
                                 if(isset($pluginClass['stackindex'])) {

+ 4 - 4
library/Zend/Application/Resource/Mail.php

@@ -102,10 +102,10 @@ class Zend_Application_Resource_Mail extends Zend_Application_Resource_ResourceA
 
     protected function _setupTransport($options)
     {
-    	if(!isset($options['type'])) {
-    		$options['type'] = 'sendmail';
-    	}
-    	
+        if(!isset($options['type'])) {
+            $options['type'] = 'sendmail';
+        }
+        
         $transportName = $options['type'];
         if(!Zend_Loader_Autoloader::autoload($transportName))
         {

+ 1 - 1
library/Zend/Application/Resource/Multidb.php

@@ -85,7 +85,7 @@ class Zend_Application_Resource_Multidb extends Zend_Application_Resource_Resour
         }
 
         foreach ($options as $id => $params) {
-        	$adapter = $params['adapter'];
+            $adapter = $params['adapter'];
             $default = (int) (
                 isset($params['isDefaultTableAdapter']) && $params['isDefaultTableAdapter']
                 || isset($params['default']) && $params['default']

+ 12 - 12
library/Zend/Application/Resource/Useragent.php

@@ -31,8 +31,8 @@ class Zend_Application_Resource_UserAgent extends Zend_Application_Resource_Reso
     /**
      * @var Zend_Http_UserAgent
      */
-	protected $_userAgent;
-	
+    protected $_userAgent;
+    
     /**
      * Intialize resource
      *
@@ -40,7 +40,7 @@ class Zend_Application_Resource_UserAgent extends Zend_Application_Resource_Reso
      */
     public function init()
     {
-		$userAgent = $this->getUserAgent();
+        $userAgent = $this->getUserAgent();
 
         // Optionally seed the UserAgent view helper
         $bootstrap = $this->getBootstrap();
@@ -53,8 +53,8 @@ class Zend_Application_Resource_UserAgent extends Zend_Application_Resource_Reso
         }
 
         return $userAgent;
-	}
-	
+    }
+    
     /**
      * Get UserAgent instance
      *
@@ -62,11 +62,11 @@ class Zend_Application_Resource_UserAgent extends Zend_Application_Resource_Reso
      */
     public function getUserAgent()
     {
-		if (null === $this->_userAgent) {
-			$options = $this->getOptions();
-			$this->_userAgent = new Zend_Http_UserAgent($options);
-		}
-		
-		return $this->_userAgent;
-	}
+        if (null === $this->_userAgent) {
+            $options = $this->getOptions();
+            $this->_userAgent = new Zend_Http_UserAgent($options);
+        }
+        
+        return $this->_userAgent;
+    }
 }

+ 2 - 2
library/Zend/Auth/Adapter/Ldap.php

@@ -335,8 +335,8 @@ class Zend_Auth_Adapter_Ldap implements Zend_Auth_Adapter_Interface
                     $messages[1] = '';
                     $messages[] = "$canonicalName authentication successful";
                     if ($requireRebind === true) {
-	                    // rebinding with authenticated user
-	                    $ldap->bind($dn, $password);
+                        // rebinding with authenticated user
+                        $ldap->bind($dn, $password);
                     }
                     return new Zend_Auth_Result(Zend_Auth_Result::SUCCESS, $canonicalName, $messages);
                 } else {

+ 32 - 32
library/Zend/Barcode/Object/Code128.php

@@ -48,9 +48,9 @@ class Zend_Barcode_Object_Code128 extends Zend_Barcode_Object_ObjectAbstract
     protected $_withChecksum = true;
 
     /**
-	 * @var array
-	 */
-	protected $_convertedText = array();
+     * @var array
+     */
+    protected $_convertedText = array();
 
     protected $_codingMap = array(
                  0 => "11011001100",   1 => "11001101100",   2 => "11001100110",
@@ -192,7 +192,7 @@ class Zend_Barcode_Object_Code128 extends Zend_Barcode_Object_ObjectAbstract
         $characterLength = 11 * $this->_barThinWidth * $this->_factor;
         $convertedChars = count($this->_convertToBarcodeChars($this->getText()));
         if ($this->_withChecksum) {
-        	$convertedChars++;
+            $convertedChars++;
         }
         $encodedData = $convertedChars * $characterLength;
         // ...except the STOP character (13)
@@ -220,7 +220,7 @@ class Zend_Barcode_Object_Code128 extends Zend_Barcode_Object_ObjectAbstract
         $convertedChars = $this->_convertToBarcodeChars($this->getText());
 
         if ($this->_withChecksum) {
-        	$convertedChars[] = $this->getChecksum($this->getText());
+            $convertedChars[] = $this->getChecksum($this->getText());
         }
 
         // STOP CHARACTER
@@ -245,17 +245,17 @@ class Zend_Barcode_Object_Code128 extends Zend_Barcode_Object_ObjectAbstract
      */
     protected static function _isDigit($string, $pos, $length = 2)
     {
-	    if ($pos + $length > strlen($string)) {
-	       return false;
-	    }
+        if ($pos + $length > strlen($string)) {
+           return false;
+        }
 
-		for ($i = $pos; $i < $pos + $length; $i++) {
-		      if (!is_numeric($string[$i])) {
-		          return false;
-		      }
-		}
-		return true;
-	}
+        for ($i = $pos; $i < $pos + $length; $i++) {
+              if (!is_numeric($string[$i])) {
+                  return false;
+              }
+        }
+        return true;
+    }
 
     /**
      * Convert string to barcode string
@@ -263,14 +263,14 @@ class Zend_Barcode_Object_Code128 extends Zend_Barcode_Object_ObjectAbstract
      */
     protected function _convertToBarcodeChars($string)
     {
-    	$string = (string) $string;
-    	if (!strlen($string)) {
-    		return array();
-    	}
+        $string = (string) $string;
+        if (!strlen($string)) {
+            return array();
+        }
 
-    	if (isset($this->_convertedText[md5($string)])) {
-    		return $this->_convertedText[md5($string)];
-    	}
+        if (isset($this->_convertedText[md5($string)])) {
+            return $this->_convertedText[md5($string)];
+        }
 
         $currentCharset = null;
         $sum = 0;
@@ -363,17 +363,17 @@ class Zend_Barcode_Object_Code128 extends Zend_Barcode_Object_ObjectAbstract
      */
     public function getChecksum($text)
     {
-    	$tableOfChars = $this->_convertToBarcodeChars($text);
+        $tableOfChars = $this->_convertToBarcodeChars($text);
 
-    	$sum = $tableOfChars[0];
-    	unset($tableOfChars[0]);
+        $sum = $tableOfChars[0];
+        unset($tableOfChars[0]);
 
-    	$k = 1;
-    	foreach ($tableOfChars as $char) {
-    		$sum += ($k++) * $char;
-    	}
+        $k = 1;
+        foreach ($tableOfChars as $char) {
+            $sum += ($k++) * $char;
+        }
 
-    	$checksum = $sum % 103;
+        $checksum = $sum % 103;
 
         return $checksum;
     }
@@ -385,7 +385,7 @@ class Zend_Barcode_Object_Code128 extends Zend_Barcode_Object_ObjectAbstract
      */
     protected function _validateText($value, $options = array())
     {
-    	// @TODO: add code128 validator
-    	return true;
+        // @TODO: add code128 validator
+        return true;
     }
 }

+ 17 - 17
library/Zend/Captcha/Word.php

@@ -131,7 +131,7 @@ abstract class Zend_Captcha_Word extends Zend_Captcha_Base
      *
      * @return string
      */
-	public function getSessionClass()
+    public function getSessionClass()
     {
         return $this->_sessionClass;
     }
@@ -217,17 +217,17 @@ abstract class Zend_Captcha_Word extends Zend_Captcha_Base
         return $this->_timeout;
     }
 
-	/**
-	 * Sets if session should be preserved on generate()
-	 *
-	 * @param $keepSession Should session be kept on generate()?
-	 * @return Zend_Captcha_Word
-	 */
-	public function setKeepSession($keepSession)
-	{
-		$this->_keepSession = $keepSession;
-		return $this;
-	}
+    /**
+     * Sets if session should be preserved on generate()
+     *
+     * @param $keepSession Should session be kept on generate()?
+     * @return Zend_Captcha_Word
+     */
+    public function setKeepSession($keepSession)
+    {
+        $this->_keepSession = $keepSession;
+        return $this;
+    }
 
     /**
      * Numbers should be included in the pattern?
@@ -239,9 +239,9 @@ abstract class Zend_Captcha_Word extends Zend_Captcha_Base
         return $this->_useNumbers;
     }
 
-	/**
-	 * Set if numbers should be included in the pattern
-	 *
+    /**
+     * Set if numbers should be included in the pattern
+     *
      * @param $_useNumbers numbers should be included in the pattern?
      * @return Zend_Captcha_Word
      */
@@ -250,8 +250,8 @@ abstract class Zend_Captcha_Word extends Zend_Captcha_Base
         $this->_useNumbers = $_useNumbers;
         return $this;
     }
-	
-	/**
+    
+    /**
      * Get session object
      *
      * @return Zend_Session_Namespace

+ 1 - 1
library/Zend/Controller/Action.php

@@ -580,7 +580,7 @@ abstract class Zend_Controller_Action implements Zend_Controller_Action_Interfac
     protected function _getParam($paramName, $default = null)
     {
         $value = $this->getRequest()->getParam($paramName);
-		 if ((null === $value || '' === $value) && (null !== $default)) {
+         if ((null === $value || '' === $value) && (null !== $default)) {
             $value = $default;
         }
 

+ 3 - 3
library/Zend/Db/Adapter/Sqlsrv.php

@@ -437,9 +437,9 @@ class Zend_Db_Adapter_Sqlsrv extends Zend_Db_Adapter_Abstract
         $sql    = "exec sp_columns @table_name = " . $this->quoteIdentifier($tableName, true);
         $stmt   = $this->query($sql);
         $result = $stmt->fetchAll(Zend_Db::FETCH_NUM);
-		
-		// ZF-7698
-		$stmt->closeCursor();
+        
+        // ZF-7698
+        $stmt->closeCursor();
 
         if (count($result) == 0) {
             return array();

+ 6 - 6
library/Zend/Db/Statement/Sqlsrv.php

@@ -376,11 +376,11 @@ class Zend_Db_Statement_Sqlsrv extends Zend_Db_Statement
             require_once 'Zend/Db/Statement/Sqlsrv/Exception.php';
             throw new Zend_Db_Statement_Sqlsrv_Exception(sqlsrv_errors());
         }
-		
-		// reset column keys
-		$this->_keys = null;
+        
+        // reset column keys
+        $this->_keys = null;
 
-		return true;
+        return true;
     }
 
     /**
@@ -411,8 +411,8 @@ class Zend_Db_Statement_Sqlsrv extends Zend_Db_Statement
 
         return $num_rows;
     }
-	
-	/**
+    
+    /**
      * Returns an array containing all of the result set rows.
      *
      * @param int $style OPTIONAL Fetch mode.

+ 8 - 8
library/Zend/Feed/Writer.php

@@ -27,20 +27,20 @@
  */
 class Zend_Feed_Writer
 {
-	/**
-	 * Namespace constants
-	 */
-	const NAMESPACE_ATOM_03  = 'http://purl.org/atom/ns#';
+    /**
+     * Namespace constants
+     */
+    const NAMESPACE_ATOM_03  = 'http://purl.org/atom/ns#';
     const NAMESPACE_ATOM_10  = 'http://www.w3.org/2005/Atom';
     const NAMESPACE_RDF      = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#';
     const NAMESPACE_RSS_090  = 'http://my.netscape.com/rdf/simple/0.9/';
     const NAMESPACE_RSS_10   = 'http://purl.org/rss/1.0/';
 
     /**
-	 * Feed type constants
-	 */
-	const TYPE_ANY              = 'any';
-	const TYPE_ATOM_03          = 'atom-03';
+     * Feed type constants
+     */
+    const TYPE_ANY              = 'any';
+    const TYPE_ATOM_03          = 'atom-03';
     const TYPE_ATOM_10          = 'atom-10';
     const TYPE_ATOM_ANY         = 'atom';
     const TYPE_RSS_090          = 'rss-090';

+ 2 - 2
library/Zend/Feed/Writer/Feed.php

@@ -205,7 +205,7 @@ implements Iterator, Countable
         return count($this->_entries);
     }
 
-	/**
+    /**
      * Return the current entry
      *
      * @return Zend_Feed_Reader_Entry_Interface
@@ -225,7 +225,7 @@ implements Iterator, Countable
         return $this->_entriesKey;
     }
 
-	/**
+    /**
      * Move the feed pointer forward
      *
      * @return void

+ 1 - 1
library/Zend/Http/Client/Adapter/Proxy.php

@@ -95,7 +95,7 @@ class Zend_Http_Client_Adapter_Proxy extends Zend_Http_Client_Adapter_Socket
 
         /* Url might require stream context even if proxy connection doesn't */
         if ($secure) {
-        	$this->config['sslusecontext'] = true;
+            $this->config['sslusecontext'] = true;
         }
 
         // Connect (a non-secure connection) to the proxy server

+ 12 - 12
library/Zend/Http/Client/Adapter/Socket.php

@@ -124,17 +124,17 @@ class Zend_Http_Client_Adapter_Socket implements Zend_Http_Client_Adapter_Interf
         }
     }
 
-	/**
- 	 * Retrieve the array of all configuration options
- 	 *
- 	 * @return array
- 	 */
- 	public function getConfig()
- 	{
- 	    return $this->config;
- 	}
-
- 	/**
+    /**
+      * Retrieve the array of all configuration options
+      *
+      * @return array
+      */
+     public function getConfig()
+     {
+         return $this->config;
+     }
+
+     /**
      * Set the stream context for the TCP connection to the server
      *
      * Can accept either a pre-existing stream context resource, or an array
@@ -405,7 +405,7 @@ class Zend_Http_Client_Adapter_Socket implements Zend_Http_Client_Adapter_Interf
                 } while ($chunksize > 0);
             } else {
                 $this->close();
-		require_once 'Zend/Http/Client/Adapter/Exception.php';
+        require_once 'Zend/Http/Client/Adapter/Exception.php';
                 throw new Zend_Http_Client_Adapter_Exception('Cannot handle "' .
                     $headers['transfer-encoding'] . '" transfer encoding');
             }

+ 6 - 6
library/Zend/Ldap.php

@@ -922,8 +922,8 @@ class Zend_Ldap
      * @param  array                                  $attributes
      * @param  string|null                            $sort
      * @param  string|null                            $collectionClass
-     * @param  integer                            	  $sizelimit
-     * @param  integer                            	  $timelimit
+     * @param  integer                                  $sizelimit
+     * @param  integer                                  $timelimit
      * @return Zend_Ldap_Collection
      * @throws Zend_Ldap_Exception
      */
@@ -1008,8 +1008,8 @@ class Zend_Ldap
     /**
      * Extension point for collection creation
      *
-     * @param  Zend_Ldap_Collection_Iterator_Default	$iterator
-     * @param  string|null								$collectionClass
+     * @param  Zend_Ldap_Collection_Iterator_Default    $iterator
+     * @param  string|null                                $collectionClass
      * @return Zend_Ldap_Collection
      * @throws Zend_Ldap_Exception
      */
@@ -1107,8 +1107,8 @@ class Zend_Ldap
      * @param  array                                  $attributes
      * @param  string|null                            $sort
      * @param  boolean                                $reverseSort
-     * @param  integer                            	  $sizelimit
-     * @param  integer                            	  $timelimit
+     * @param  integer                                  $sizelimit
+     * @param  integer                                  $timelimit
      * @return array
      * @throws Zend_Ldap_Exception
      */

+ 9 - 9
library/Zend/Ldap/Attribute.php

@@ -214,9 +214,9 @@ class Zend_Ldap_Attribute
     /**
      * Converts a PHP data type into its LDAP representation
      *
-     * @deprected	use Zend_Ldap_Converter instead
-     * @param  		mixed $value
-     * @return 		string|null - null if the PHP data type cannot be converted.
+     * @deprected    use Zend_Ldap_Converter instead
+     * @param          mixed $value
+     * @return         string|null - null if the PHP data type cannot be converted.
      */
     public static function convertToLdapValue($value)
     {
@@ -226,9 +226,9 @@ class Zend_Ldap_Attribute
     /**
      * Converts an LDAP value into its PHP data type
      *
-     * @deprected	use Zend_Ldap_Converter instead
-     * @param  		string $value
-     * @return 		mixed
+     * @deprected    use Zend_Ldap_Converter instead
+     * @param          string $value
+     * @return         mixed
      */
     public static function convertFromLdapValue($value)
     {
@@ -392,9 +392,9 @@ class Zend_Ldap_Attribute
             }
         }
         else {
-			$newVal = self::_valueFromLdapDateTime($values);
-			if ($newVal !== null) $values = $newVal;
-		}
+            $newVal = self::_valueFromLdapDateTime($values);
+            if ($newVal !== null) $values = $newVal;
+        }
         return $values;
     }
 

+ 30 - 30
library/Zend/Ldap/Converter.php

@@ -73,7 +73,7 @@ class Zend_Ldap_Converter
         return $string;
     }
 
-	/**
+    /**
      * Convert any value to an LDAP-compatible value.
      *
      * By setting the <var>$type</var>-parameter the conversion of a certain
@@ -81,10 +81,10 @@ class Zend_Ldap_Converter
      *
      * @todo write more tests
      *
-     * @param	mixed 	$value 	The value to convert
-     * @param	int   	$ytpe  	The conversion type to use
-     * @return	string
-     * @throws	Zend_Ldap_Converter_Exception
+     * @param    mixed     $value     The value to convert
+     * @param    int       $ytpe      The conversion type to use
+     * @return    string
+     * @throws    Zend_Ldap_Converter_Exception
      */
     public static function toLdap($value, $type = self::STANDARD)
     {
@@ -132,11 +132,11 @@ class Zend_Ldap_Converter
      * DateTime Object, a string that is parseable by strtotime() or a Zend_Date
      * Object.
      *
-     * @param	integer|string|DateTimt|Zend_Date		$date	The date-entity
-     * @param	boolean									$asUtc	Whether to return the LDAP-compatible date-string
-     *                          								as UTC or as local value
-     * @return	string
-     * @throws	InvalidArgumentException
+     * @param    integer|string|DateTimt|Zend_Date        $date    The date-entity
+     * @param    boolean                                    $asUtc    Whether to return the LDAP-compatible date-string
+     *                                                          as UTC or as local value
+     * @return    string
+     * @throws    InvalidArgumentException
      */
     public static function toLdapDateTime($date, $asUtc = true)
     {
@@ -170,8 +170,8 @@ class Zend_Ldap_Converter
      * case-insensitive string 'true' to an LDAP-compatible 'TRUE'. All other
      * other values are converted to an LDAP-compatible 'FALSE'.
      *
-     * @param	boolean|integer|string		$value	The boolean value to encode
-     * @return	string
+     * @param    boolean|integer|string        $value    The boolean value to encode
+     * @return    string
      */
     public static function toLdapBoolean($value)
     {
@@ -188,8 +188,8 @@ class Zend_Ldap_Converter
     /**
      * Serialize any value for storage in LDAP
      *
-     * @param	mixed		$value	The value to serialize
-     * @return	string
+     * @param    mixed        $value    The value to serialize
+     * @return    string
      */
     public static function toLdapSerialize($value)
     {
@@ -202,11 +202,11 @@ class Zend_Ldap_Converter
      * By setting the <var>$type</var>-parameter the conversion of a certain
      * type can be forced
      * .
-     * @param	string	$value 			The value to convert
-     * @param	int		$ytpe  			The conversion type to use
-     * @param	boolean	$dateTimeAsUtc	Return DateTime values in UTC timezone
-     * @return	mixed
-     * @throws	Zend_Ldap_Converter_Exception
+     * @param    string    $value             The value to convert
+     * @param    int        $ytpe              The conversion type to use
+     * @param    boolean    $dateTimeAsUtc    Return DateTime values in UTC timezone
+     * @return    mixed
+     * @throws    Zend_Ldap_Converter_Exception
      */
     public static function fromLdap($value, $type = self::STANDARD, $dateTimeAsUtc = true)
     {
@@ -239,10 +239,10 @@ class Zend_Ldap_Converter
      *
      * CAVEAT: The DateTime-Object returned will alwasy be set to UTC-Timezone.
      *
-     * @param	string		$date	The generalized-Time
-     * @param	boolean		$asUtc	Return the DateTime with UTC timezone
-     * @return	DateTime
-     * @throws	InvalidArgumentException if a non-parseable-format is given
+     * @param    string        $date    The generalized-Time
+     * @param    boolean        $asUtc    Return the DateTime with UTC timezone
+     * @return    DateTime
+     * @throws    InvalidArgumentException if a non-parseable-format is given
      */
     public static function fromLdapDateTime($date, $asUtc = true)
     {
@@ -265,7 +265,7 @@ class Zend_Ldap_Converter
             'second' => 0,
             'offdir' => '+',
             'offsethours' => 0,
-			'offsetminutes' => 0
+            'offsetminutes' => 0
         );
 
         $length = strlen($date);
@@ -363,9 +363,9 @@ class Zend_Ldap_Converter
     /**
      * Convert an LDAP-compatible boolean value into a PHP-compatible one
      *
-     * @param	string		$value		The value to convert
-     * @return	boolean
-     * @throws	InvalidArgumentException
+     * @param    string        $value        The value to convert
+     * @return    boolean
+     * @throws    InvalidArgumentException
      */
     public static function fromLdapBoolean($value)
     {
@@ -381,9 +381,9 @@ class Zend_Ldap_Converter
     /**
      * Unserialize a serialized value to return the corresponding object
      *
-     * @param	string		$value	The value to convert
-     * @return	mixed
-     * @throws	UnexpectedValueException
+     * @param    string        $value    The value to convert
+     * @return    mixed
+     * @throws    UnexpectedValueException
      */
     public static function fromLdapUnserialize($value)
     {

+ 1 - 1
library/Zend/Log.php

@@ -491,7 +491,7 @@ class Zend_Log
     {
         // Only register once.  Avoids loop issues if it gets registered twice.
         if ($this->_registeredErrorHandler) {
-        	return $this;
+            return $this;
         }
 
         $this->_origErrorHandler = set_error_handler(array($this, 'errorHandler'));

+ 2 - 2
library/Zend/Log/Writer/Abstract.php

@@ -128,8 +128,8 @@ abstract class Zend_Log_Writer_Abstract implements Zend_Log_FactoryInterface
         if (!is_array($config)) {
             require_once 'Zend/Log/Exception.php';
             throw new Zend_Log_Exception(
-				'Configuration must be an array or instance of Zend_Config'
-			);
+                'Configuration must be an array or instance of Zend_Config'
+            );
         }
 
         return $config;

+ 4 - 4
library/Zend/Log/Writer/Mail.php

@@ -106,7 +106,7 @@ class Zend_Log_Writer_Mail extends Zend_Log_Writer_Abstract
      * @var array
      */
     protected static $_methodMapHeaders = array(
-    	'from' => 'setFrom',
+        'from' => 'setFrom',
         'to' => 'addTo',
         'cc' => 'addCc',
         'bcc' => 'addBcc',
@@ -148,7 +148,7 @@ class Zend_Log_Writer_Mail extends Zend_Log_Writer_Abstract
             $writer->setLayout($config);
         }
         if (isset($config['layoutFormatter'])) {
-        	$layoutFormatter = new $config['layoutFormatter'];
+            $layoutFormatter = new $config['layoutFormatter'];
             $writer->setLayoutFormatter($layoutFormatter);
         }
         if (isset($config['subjectPrependText'])) {
@@ -213,8 +213,8 @@ class Zend_Log_Writer_Mail extends Zend_Log_Writer_Abstract
                     && !is_numeric($address['name'])
                 ) {
                     $params = array(
-                    	$address['email'],
-                    	$address['name']
+                        $address['email'],
+                        $address['name']
                     );
                 } else if (is_array($address) && isset($address['email'])) {
                     $params = array($address['email']);

+ 1 - 1
library/Zend/Markup/Token.php

@@ -260,7 +260,7 @@ class Zend_Markup_Token
         return $this->_children;
     }
 
-	/**
+    /**
      * Does this token have any children
      *
      * @return bool

+ 10 - 10
library/Zend/Rest/Route.php

@@ -98,13 +98,13 @@ class Zend_Rest_Route extends Zend_Controller_Router_Route_Module
         $defaultsArray = array();
         $restfulConfigArray = array();
         foreach ($config as $key => $values) {
-        	if ($key == 'type') {
-        		// do nothing
-        	} elseif ($key == 'defaults') {
-        		$defaultsArray = $values->toArray();
-        	} else {
-        		$restfulConfigArray[$key] = explode(',', $values);
-        	}
+            if ($key == 'type') {
+                // do nothing
+            } elseif ($key == 'defaults') {
+                $defaultsArray = $values->toArray();
+            } else {
+                $restfulConfigArray[$key] = explode(',', $values);
+            }
         }
         $instance = new self($frontController, $defaultsArray, $restfulConfigArray);
         return $instance;
@@ -161,10 +161,10 @@ class Zend_Rest_Route extends Zend_Controller_Router_Route_Module
                     return false;
                 }
             } elseif ($this->_checkRestfulController($moduleName, $controllerName)) {
-            	$values[$this->_controllerKey] = $controllerName;
-            	$values[$this->_actionKey] = 'get';
+                $values[$this->_controllerKey] = $controllerName;
+                $values[$this->_actionKey] = 'get';
             } else {
-            	return false;
+                return false;
             }
 
             //Store path count for method mapping

+ 9 - 9
library/Zend/Service/Amazon/Item.php

@@ -114,20 +114,20 @@ class Zend_Service_Amazon_Item
      *
      * @param  null|DOMElement $dom
      * @return void
-     * @throws	Zend_Service_Amazon_Exception
+     * @throws    Zend_Service_Amazon_Exception
      *
      * @group ZF-9547
      */
     public function __construct($dom)
     {
-    	if (null === $dom) {
-    		require_once 'Zend/Service/Amazon/Exception.php';
-    		throw new Zend_Service_Amazon_Exception('Item element is empty');
-    	}
-    	if (!$dom instanceof DOMElement) {
-    		require_once 'Zend/Service/Amazon/Exception.php';
-    		throw new Zend_Service_Amazon_Exception('Item is not a valid DOM element');
-    	}
+        if (null === $dom) {
+            require_once 'Zend/Service/Amazon/Exception.php';
+            throw new Zend_Service_Amazon_Exception('Item element is empty');
+        }
+        if (!$dom instanceof DOMElement) {
+            require_once 'Zend/Service/Amazon/Exception.php';
+            throw new Zend_Service_Amazon_Exception('Item is not a valid DOM element');
+        }
         $xpath = new DOMXPath($dom->ownerDocument);
         $xpath->registerNamespace('az', 'http://webservices.amazon.com/AWSECommerceService/2005-10-05');
         $this->ASIN = $xpath->query('./az:ASIN/text()', $dom)->item(0)->data;

+ 5 - 5
library/Zend/Service/Amazon/S3.php

@@ -557,11 +557,11 @@ class Zend_Service_Amazon_S3 extends Zend_Service_Amazon_Abstract
     /**
      * Make a request to Amazon S3
      *
-     * @param  string $method	Request method
-     * @param  string $path		Path to requested object
-     * @param  array  $params	Request parameters
-     * @param  array  $headers	HTTP headers
-     * @param  string|resource $data		Request data
+     * @param  string $method    Request method
+     * @param  string $path        Path to requested object
+     * @param  array  $params    Request parameters
+     * @param  array  $headers    HTTP headers
+     * @param  string|resource $data        Request data
      * @return Zend_Http_Response
      */
     public function _makeRequest($method, $path='', $params=null, $headers=array(), $data=null)

+ 87 - 87
library/Zend/Service/Amazon/SimpleDb.php

@@ -100,7 +100,7 @@ class Zend_Service_Amazon_SimpleDb extends Zend_Service_Amazon_Abstract
         $this->setEndpoint("https://" . $this->_sdbEndpoint);
     }
 
-	/**
+    /**
      * Set SimpleDB endpoint to use
      *
      * @param string|Zend_Uri_Http $endpoint
@@ -108,15 +108,15 @@ class Zend_Service_Amazon_SimpleDb extends Zend_Service_Amazon_Abstract
      */
     public function setEndpoint($endpoint)
     {
-    	if(!($endpoint instanceof Zend_Uri_Http)) {
-    		$endpoint = Zend_Uri::factory($endpoint);
-    	}
-    	if(!$endpoint->valid()) {
-    		require_once 'Zend/Service/Amazon/SimpleDb/Exception.php';
-    		throw new Zend_Service_Amazon_SimpleDb_Exception("Invalid endpoint supplied");
-    	}
-    	$this->_endpoint = $endpoint;
-    	return $this;
+        if(!($endpoint instanceof Zend_Uri_Http)) {
+            $endpoint = Zend_Uri::factory($endpoint);
+        }
+        if(!$endpoint->valid()) {
+            require_once 'Zend/Service/Amazon/SimpleDb/Exception.php';
+            throw new Zend_Service_Amazon_SimpleDb_Exception("Invalid endpoint supplied");
+        }
+        $this->_endpoint = $endpoint;
+        return $this;
     }
 
     /**
@@ -126,7 +126,7 @@ class Zend_Service_Amazon_SimpleDb extends Zend_Service_Amazon_Abstract
      */
     public function getEndpoint()
     {
-    	return $this->_endpoint;
+        return $this->_endpoint;
     }
 
     /**
@@ -139,15 +139,15 @@ class Zend_Service_Amazon_SimpleDb extends Zend_Service_Amazon_Abstract
         $domainName, $itemName, $attributeName = null
     ) {
         $params               = array();
-	    $params['Action']     = 'GetAttributes';
-	    $params['DomainName'] = $domainName;
-	    $params['ItemName']   = $itemName;
+        $params['Action']     = 'GetAttributes';
+        $params['DomainName'] = $domainName;
+        $params['ItemName']   = $itemName;
 
-	    if (isset($attributeName)) {
-	        $params['AttributeName'] = $attributeName;
-	    }
+        if (isset($attributeName)) {
+            $params['AttributeName'] = $attributeName;
+        }
 
-	    $response = $this->_sendRequest($params);
+        $response = $this->_sendRequest($params);
         $document = $response->getSimpleXMLDocument();
 
         $attributeNodes = $document->GetAttributesResult->Attribute;
@@ -188,26 +188,26 @@ class Zend_Service_Amazon_SimpleDb extends Zend_Service_Amazon_Abstract
         $domainName, $itemName, $attributes, $replace = array()
     ) {
         $params               = array();
-	    $params['Action']     = 'PutAttributes';
-	    $params['DomainName'] = $domainName;
-	    $params['ItemName']   = $itemName;
+        $params['Action']     = 'PutAttributes';
+        $params['DomainName'] = $domainName;
+        $params['ItemName']   = $itemName;
 
-	    $index = 0;
-	    foreach ($attributes as $attribute) {
-	        $attributeName = $attribute->getName();
+        $index = 0;
+        foreach ($attributes as $attribute) {
+            $attributeName = $attribute->getName();
             foreach ($attribute->getValues() as $value) {
-	            $params['Attribute.' . $index . '.Name']  = $attributeName;
+                $params['Attribute.' . $index . '.Name']  = $attributeName;
                 $params['Attribute.' . $index . '.Value'] = $value;
 
-	            // Check if it should be replaced
+                // Check if it should be replaced
                 if(array_key_exists($attributeName, $replace) && $replace[$attributeName]) {
                     $params['Attribute.' . $index . '.Replace'] = 'true';
                 }
                 $index++;
             }
-	    }
+        }
 
-	    // Exception should get thrown if there's an error
+        // Exception should get thrown if there's an error
         $response = $this->_sendRequest($params);
     }
 
@@ -262,18 +262,18 @@ class Zend_Service_Amazon_SimpleDb extends Zend_Service_Amazon_Abstract
     public function deleteAttributes($domainName, $itemName, array $attributes = array())
     {
         $params               = array();
-	    $params['Action']     = 'DeleteAttributes';
-	    $params['DomainName'] = $domainName;
-	    $params['ItemName']   = $itemName;
-
-	    $attributeIndex = 0;
-	    foreach ($attributes as $attribute) {
-	        foreach ($attribute->getValues() as $value) {
-	            $params['Attribute.' . $attributeIndex . '.Name'] = $attribute->getName();
-	            $params['Attribute.' . $attributeIndex . '.Value'] = $value;
+        $params['Action']     = 'DeleteAttributes';
+        $params['DomainName'] = $domainName;
+        $params['ItemName']   = $itemName;
+
+        $attributeIndex = 0;
+        foreach ($attributes as $attribute) {
+            foreach ($attribute->getValues() as $value) {
+                $params['Attribute.' . $attributeIndex . '.Name'] = $attribute->getName();
+                $params['Attribute.' . $attributeIndex . '.Value'] = $value;
                 $attributeIndex++;
-	        }
-	    }
+            }
+        }
 
         $response = $this->_sendRequest($params);
 
@@ -290,12 +290,12 @@ class Zend_Service_Amazon_SimpleDb extends Zend_Service_Amazon_Abstract
     public function listDomains($maxNumberOfDomains = 100, $nextToken = null)
     {
         $params                       = array();
-	    $params['Action']             = 'ListDomains';
-	    $params['MaxNumberOfDomains'] = $maxNumberOfDomains;
+        $params['Action']             = 'ListDomains';
+        $params['MaxNumberOfDomains'] = $maxNumberOfDomains;
 
-	    if (null !== $nextToken) {
-	        $params['NextToken'] = $nextToken;
-	    }
+        if (null !== $nextToken) {
+            $params['NextToken'] = $nextToken;
+        }
         $response = $this->_sendRequest($params);
 
         $domainNodes = $response->getSimpleXMLDocument()->ListDomainsResult->DomainName;
@@ -321,8 +321,8 @@ class Zend_Service_Amazon_SimpleDb extends Zend_Service_Amazon_Abstract
     public function domainMetadata($domainName)
     {
         $params               = array();
-	    $params['Action']     = 'DomainMetadata';
-	    $params['DomainName'] = $domainName;
+        $params['Action']     = 'DomainMetadata';
+        $params['DomainName'] = $domainName;
         $response             = $this->_sendRequest($params);
 
         $document = $response->getSimpleXMLDocument();
@@ -340,14 +340,14 @@ class Zend_Service_Amazon_SimpleDb extends Zend_Service_Amazon_Abstract
     /**
      * Create a new domain
      *
-     * @param $domainName	string	Valid domain name of the domain to create
-     * @return 				boolean True if successful, false if not
+     * @param $domainName    string    Valid domain name of the domain to create
+     * @return                 boolean True if successful, false if not
      */
-	public function createDomain($domainName)
-	{
+    public function createDomain($domainName)
+    {
         $params               = array();
-	    $params['Action']     = 'CreateDomain';
-	    $params['DomainName'] = $domainName;
+        $params['Action']     = 'CreateDomain';
+        $params['DomainName'] = $domainName;
         $response             = $this->_sendRequest($params);
         return $response->getHttpResponse()->isSuccessful();
     }
@@ -355,14 +355,14 @@ class Zend_Service_Amazon_SimpleDb extends Zend_Service_Amazon_Abstract
     /**
      * Delete a domain
      *
-     * @param 	$domainName string  Valid domain name of the domain to delete
-     * @return 				boolean True if successful, false if not
+     * @param     $domainName string  Valid domain name of the domain to delete
+     * @return                 boolean True if successful, false if not
      */
-	public function deleteDomain($domainName)
-	{
-	    $params               = array();
-	    $params['Action']     = 'DeleteDomain';
-	    $params['DomainName'] = $domainName;
+    public function deleteDomain($domainName)
+    {
+        $params               = array();
+        $params['Action']     = 'DeleteDomain';
+        $params['DomainName'] = $domainName;
         $response             = $this->_sendRequest($params);
         return $response->getHttpResponse()->isSuccessful();
     }
@@ -374,15 +374,15 @@ class Zend_Service_Amazon_SimpleDb extends Zend_Service_Amazon_Abstract
      * @param  null|string $nextToken
      * @return Zend_Service_Amazon_SimpleDb_Page
      */
-	public function select($selectExpression, $nextToken = null)
-	{
+    public function select($selectExpression, $nextToken = null)
+    {
         $params                     = array();
-	    $params['Action']           = 'Select';
-	    $params['SelectExpression'] = $selectExpression;
+        $params['Action']           = 'Select';
+        $params['SelectExpression'] = $selectExpression;
 
-	    if (null !== $nextToken) {
-	        $params['NextToken'] = $nextToken;
-	    }
+        if (null !== $nextToken) {
+            $params['NextToken'] = $nextToken;
+        }
 
         $response = $this->_sendRequest($params);
         $xml      = $response->getSimpleXMLDocument();
@@ -407,33 +407,33 @@ class Zend_Service_Amazon_SimpleDb extends Zend_Service_Amazon_Abstract
         return new Zend_Service_Amazon_SimpleDb_Page($attributes, $nextToken);
     }
 
-	/**
-	 * Quote SDB value
-	 *
-	 * Wraps it in ''
-	 *
-	 * @param string $value
-	 * @return string
-	 */
+    /**
+     * Quote SDB value
+     *
+     * Wraps it in ''
+     *
+     * @param string $value
+     * @return string
+     */
     public function quote($value)
     {
-    	// wrap in single quotes and convert each ' inside to ''
-    	return "'" . str_replace("'", "''", $value) . "'";
+        // wrap in single quotes and convert each ' inside to ''
+        return "'" . str_replace("'", "''", $value) . "'";
     }
 
-	/**
-	 * Quote SDB column or table name
-	 *
-	 * Wraps it in ``
-	 * @param string $name
-	 * @return string
-	 */
+    /**
+     * Quote SDB column or table name
+     *
+     * Wraps it in ``
+     * @param string $name
+     * @return string
+     */
     public function quoteName($name)
     {
-    	if (preg_match('/^[a-z_$][a-z0-9_$-]*$/i', $name) == false) {
-    		throw new Zend_Service_Amazon_SimpleDb_Exception("Invalid name: can contain only alphanumeric characters, \$ and _");
-    	}
-    	return "`$name`";
+        if (preg_match('/^[a-z_$][a-z0-9_$-]*$/i', $name) == false) {
+            throw new Zend_Service_Amazon_SimpleDb_Exception("Invalid name: can contain only alphanumeric characters, \$ and _");
+        }
+        return "`$name`";
     }
 
    /**

+ 3 - 3
library/Zend/Service/Amazon/SimpleDb/Attribute.php

@@ -53,7 +53,7 @@ class Zend_Service_Amazon_SimpleDb_Attribute
         }
     }
 
-	/**
+    /**
      * Return the item name to which the attribute belongs
      *
      * @return string
@@ -63,7 +63,7 @@ class Zend_Service_Amazon_SimpleDb_Attribute
         return $this->_itemName;
     }
 
-	/**
+    /**
      * Retrieve attribute values
      *
      * @return array
@@ -73,7 +73,7 @@ class Zend_Service_Amazon_SimpleDb_Attribute
         return $this->_values;
     }
 
-	/**
+    /**
      * Retrieve the attribute name
      *
      * @return string

+ 202 - 202
library/Zend/Service/WindowsAzure/Credentials/CredentialsAbstract.php

@@ -37,208 +37,208 @@ require_once 'Zend/Service/WindowsAzure/Credentials/Exception.php';
  */
 abstract class Zend_Service_WindowsAzure_Credentials_CredentialsAbstract
 {
-	/**
-	 * Development storage account and key
-	 */
-	const DEVSTORE_ACCOUNT       = "devstoreaccount1";
-	const DEVSTORE_KEY           = "Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==";
-	
-	/**
-	 * HTTP header prefixes
-	 */
-	const PREFIX_PROPERTIES      = "x-ms-prop-";
-	const PREFIX_METADATA        = "x-ms-meta-";
-	const PREFIX_STORAGE_HEADER  = "x-ms-";
-	
-	/**
-	 * Permissions
-	 */
-	const PERMISSION_READ        = "r";
-	const PERMISSION_WRITE       = "w";
-	const PERMISSION_DELETE      = "d";
-	const PERMISSION_LIST        = "l";
+    /**
+     * Development storage account and key
+     */
+    const DEVSTORE_ACCOUNT       = "devstoreaccount1";
+    const DEVSTORE_KEY           = "Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==";
+    
+    /**
+     * HTTP header prefixes
+     */
+    const PREFIX_PROPERTIES      = "x-ms-prop-";
+    const PREFIX_METADATA        = "x-ms-meta-";
+    const PREFIX_STORAGE_HEADER  = "x-ms-";
+    
+    /**
+     * Permissions
+     */
+    const PERMISSION_READ        = "r";
+    const PERMISSION_WRITE       = "w";
+    const PERMISSION_DELETE      = "d";
+    const PERMISSION_LIST        = "l";
 
-	/**
-	 * Account name for Windows Azure
-	 *
-	 * @var string
-	 */
-	protected $_accountName = '';
-	
-	/**
-	 * Account key for Windows Azure
-	 *
-	 * @var string
-	 */
-	protected $_accountKey = '';
-	
-	/**
-	 * Use path-style URI's
-	 *
-	 * @var boolean
-	 */
-	protected $_usePathStyleUri = false;
-	
-	/**
-	 * Creates a new Zend_Service_WindowsAzure_Credentials_CredentialsAbstract instance
-	 *
-	 * @param string $accountName Account name for Windows Azure
-	 * @param string $accountKey Account key for Windows Azure
-	 * @param boolean $usePathStyleUri Use path-style URI's
-	 */
-	public function __construct(
-		$accountName = Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::DEVSTORE_ACCOUNT,
-		$accountKey  = Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::DEVSTORE_KEY,
-		$usePathStyleUri = false
-	) {
-		$this->_accountName = $accountName;
-		$this->_accountKey = base64_decode($accountKey);
-		$this->_usePathStyleUri = $usePathStyleUri;
-	}
-	
-	/**
-	 * Set account name for Windows Azure
-	 *
-	 * @param  string $value
-	 * @return Zend_Service_WindowsAzure_Credentials_CredentialsAbstract
-	 */
-	public function setAccountName($value = Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::DEVSTORE_ACCOUNT)
-	{
-		$this->_accountName = $value;
-		return $this;
-	}
-	
-	/**
-	 * Set account key for Windows Azure
-	 *
-	 * @param  string $value
-	 * @return Zend_Service_WindowsAzure_Credentials_CredentialsAbstract
-	 */
-	public function setAccountkey($value = Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::DEVSTORE_KEY)
-	{
-		$this->_accountKey = base64_decode($value);
-		return $this;
-	}
-	
-	/**
-	 * Set use path-style URI's
-	 *
-	 * @param  boolean $value
-	 * @return Zend_Service_WindowsAzure_Credentials_CredentialsAbstract
-	 */
-	public function setUsePathStyleUri($value = false)
-	{
-		$this->_usePathStyleUri = $value;
-		return $this;
-	}
-	
-	/**
-	 * Sign request URL with credentials
-	 *
-	 * @param string $requestUrl Request URL
-	 * @param string $resourceType Resource type
-	 * @param string $requiredPermission Required permission
-	 * @return string Signed request URL
-	 */
-	abstract public function signRequestUrl(
-		$requestUrl = '',
-		$resourceType = Zend_Service_WindowsAzure_Storage::RESOURCE_UNKNOWN,
-		$requiredPermission = Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PERMISSION_READ
-	);
-	
-	/**
-	 * Sign request headers with credentials
-	 *
-	 * @param string $httpVerb HTTP verb the request will use
-	 * @param string $path Path for the request
-	 * @param string $queryString Query string for the request
-	 * @param array $headers x-ms headers to add
-	 * @param boolean $forTableStorage Is the request for table storage?
-	 * @param string $resourceType Resource type
-	 * @param string $requiredPermission Required permission
-	 * @param mixed  $rawData Raw post data
-	 * @return array Array of headers
-	 */
-	abstract public function signRequestHeaders(
-		$httpVerb = Zend_Http_Client::GET,
-		$path = '/',
-		$queryString = '',
-		$headers = null,
-		$forTableStorage = false,
-		$resourceType = Zend_Service_WindowsAzure_Storage::RESOURCE_UNKNOWN,
-		$requiredPermission = Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PERMISSION_READ,
-		$rawData = null
-	);
-	
-	
-	/**
-	 * Prepare query string for signing
-	 *
-	 * @param  string $value Original query string
-	 * @return string        Query string for signing
-	 */
-	protected function _prepareQueryStringForSigning($value)
-	{
-	    // Return value
-	    $returnValue = array();
-	
-	    // Prepare query string
-	    $queryParts = $this->_makeArrayOfQueryString($value);
-	    foreach ($queryParts as $key => $value) {
-	    	$returnValue[] = $key . '=' . $value;
-	    }
-	
-	    // Return
-	    if (count($returnValue) > 0) {
-	    	return '?' . implode('&', $returnValue);
-	    } else {
-	    	return '';
-	    }
-	}
-	
-	/**
-	 * Make array of query string
-	 *
-	 * @param  string $value Query string
-	 * @return array         Array of key/value pairs
-	 */
-	protected function _makeArrayOfQueryString($value)
-	{
-		// Returnvalue
-		$returnValue = array();
-		
-	    // Remove front ?
-   		if (strlen($value) > 0 && strpos($value, '?') === 0) {
-    		$value = substr($value, 1);
-    	}
-    		
-    	// Split parts
-    	$queryParts = explode('&', $value);
-    	foreach ($queryParts as $queryPart) {
-    		$queryPart = explode('=', $queryPart, 2);
-    		
-    		if ($queryPart[0] != '') {
-    			$returnValue[ $queryPart[0] ] = isset($queryPart[1]) ? $queryPart[1] : '';
-    		}
-    	}
-    	
-    	// Sort
-    	ksort($returnValue);
+    /**
+     * Account name for Windows Azure
+     *
+     * @var string
+     */
+    protected $_accountName = '';
+    
+    /**
+     * Account key for Windows Azure
+     *
+     * @var string
+     */
+    protected $_accountKey = '';
+    
+    /**
+     * Use path-style URI's
+     *
+     * @var boolean
+     */
+    protected $_usePathStyleUri = false;
+    
+    /**
+     * Creates a new Zend_Service_WindowsAzure_Credentials_CredentialsAbstract instance
+     *
+     * @param string $accountName Account name for Windows Azure
+     * @param string $accountKey Account key for Windows Azure
+     * @param boolean $usePathStyleUri Use path-style URI's
+     */
+    public function __construct(
+        $accountName = Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::DEVSTORE_ACCOUNT,
+        $accountKey  = Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::DEVSTORE_KEY,
+        $usePathStyleUri = false
+    ) {
+        $this->_accountName = $accountName;
+        $this->_accountKey = base64_decode($accountKey);
+        $this->_usePathStyleUri = $usePathStyleUri;
+    }
+    
+    /**
+     * Set account name for Windows Azure
+     *
+     * @param  string $value
+     * @return Zend_Service_WindowsAzure_Credentials_CredentialsAbstract
+     */
+    public function setAccountName($value = Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::DEVSTORE_ACCOUNT)
+    {
+        $this->_accountName = $value;
+        return $this;
+    }
+    
+    /**
+     * Set account key for Windows Azure
+     *
+     * @param  string $value
+     * @return Zend_Service_WindowsAzure_Credentials_CredentialsAbstract
+     */
+    public function setAccountkey($value = Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::DEVSTORE_KEY)
+    {
+        $this->_accountKey = base64_decode($value);
+        return $this;
+    }
+    
+    /**
+     * Set use path-style URI's
+     *
+     * @param  boolean $value
+     * @return Zend_Service_WindowsAzure_Credentials_CredentialsAbstract
+     */
+    public function setUsePathStyleUri($value = false)
+    {
+        $this->_usePathStyleUri = $value;
+        return $this;
+    }
+    
+    /**
+     * Sign request URL with credentials
+     *
+     * @param string $requestUrl Request URL
+     * @param string $resourceType Resource type
+     * @param string $requiredPermission Required permission
+     * @return string Signed request URL
+     */
+    abstract public function signRequestUrl(
+        $requestUrl = '',
+        $resourceType = Zend_Service_WindowsAzure_Storage::RESOURCE_UNKNOWN,
+        $requiredPermission = Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PERMISSION_READ
+    );
+    
+    /**
+     * Sign request headers with credentials
+     *
+     * @param string $httpVerb HTTP verb the request will use
+     * @param string $path Path for the request
+     * @param string $queryString Query string for the request
+     * @param array $headers x-ms headers to add
+     * @param boolean $forTableStorage Is the request for table storage?
+     * @param string $resourceType Resource type
+     * @param string $requiredPermission Required permission
+     * @param mixed  $rawData Raw post data
+     * @return array Array of headers
+     */
+    abstract public function signRequestHeaders(
+        $httpVerb = Zend_Http_Client::GET,
+        $path = '/',
+        $queryString = '',
+        $headers = null,
+        $forTableStorage = false,
+        $resourceType = Zend_Service_WindowsAzure_Storage::RESOURCE_UNKNOWN,
+        $requiredPermission = Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PERMISSION_READ,
+        $rawData = null
+    );
+    
+    
+    /**
+     * Prepare query string for signing
+     *
+     * @param  string $value Original query string
+     * @return string        Query string for signing
+     */
+    protected function _prepareQueryStringForSigning($value)
+    {
+        // Return value
+        $returnValue = array();
+    
+        // Prepare query string
+        $queryParts = $this->_makeArrayOfQueryString($value);
+        foreach ($queryParts as $key => $value) {
+            $returnValue[] = $key . '=' . $value;
+        }
+    
+        // Return
+        if (count($returnValue) > 0) {
+            return '?' . implode('&', $returnValue);
+        } else {
+            return '';
+        }
+    }
+    
+    /**
+     * Make array of query string
+     *
+     * @param  string $value Query string
+     * @return array         Array of key/value pairs
+     */
+    protected function _makeArrayOfQueryString($value)
+    {
+        // Returnvalue
+        $returnValue = array();
+        
+        // Remove front ?
+           if (strlen($value) > 0 && strpos($value, '?') === 0) {
+            $value = substr($value, 1);
+        }
+            
+        // Split parts
+        $queryParts = explode('&', $value);
+        foreach ($queryParts as $queryPart) {
+            $queryPart = explode('=', $queryPart, 2);
+            
+            if ($queryPart[0] != '') {
+                $returnValue[ $queryPart[0] ] = isset($queryPart[1]) ? $queryPart[1] : '';
+            }
+        }
+        
+        // Sort
+        ksort($returnValue);
 
-    	// Return
-		return $returnValue;
-	}
-	
-	/**
-	 * Returns an array value if the key is set, otherwide returns $valueIfNotSet
-	 *
-	 * @param array $array
-	 * @param mixed $key
-	 * @param mixed $valueIfNotSet
-	 * @return mixed
-	 */
-	protected function _issetOr($array, $key, $valueIfNotSet)
-	{
-		return isset($array[$key]) ? $array[$key] : $valueIfNotSet;
-	}
+        // Return
+        return $returnValue;
+    }
+    
+    /**
+     * Returns an array value if the key is set, otherwide returns $valueIfNotSet
+     *
+     * @param array $array
+     * @param mixed $key
+     * @param mixed $valueIfNotSet
+     * @return mixed
+     */
+    protected function _issetOr($array, $key, $valueIfNotSet)
+    {
+        return isset($array[$key]) ? $array[$key] : $valueIfNotSet;
+    }
 }

+ 184 - 184
library/Zend/Service/WindowsAzure/Credentials/SharedAccessSignature.php

@@ -50,59 +50,59 @@ class Zend_Service_WindowsAzure_Credentials_SharedAccessSignature
      */
     protected $_permissionSet = array();
 
-	/**
-	 * Creates a new Zend_Service_WindowsAzure_Credentials_SharedAccessSignature instance
-	 *
-	 * @param string $accountName Account name for Windows Azure
-	 * @param string $accountKey Account key for Windows Azure
-	 * @param boolean $usePathStyleUri Use path-style URI's
-	 * @param array $permissionSet Permission set
-	 */
-	public function __construct(
-		$accountName = Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::DEVSTORE_ACCOUNT,
-		$accountKey  = Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::DEVSTORE_KEY,
-		$usePathStyleUri = false, $permissionSet = array()
-	) {
-	    parent::__construct($accountName, $accountKey, $usePathStyleUri);
-	    $this->_permissionSet = $permissionSet;
-	}
-	
-	/**
-	 * Get permission set
-	 *
-	 * @return array
-	 */
+    /**
+     * Creates a new Zend_Service_WindowsAzure_Credentials_SharedAccessSignature instance
+     *
+     * @param string $accountName Account name for Windows Azure
+     * @param string $accountKey Account key for Windows Azure
+     * @param boolean $usePathStyleUri Use path-style URI's
+     * @param array $permissionSet Permission set
+     */
+    public function __construct(
+        $accountName = Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::DEVSTORE_ACCOUNT,
+        $accountKey  = Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::DEVSTORE_KEY,
+        $usePathStyleUri = false, $permissionSet = array()
+    ) {
+        parent::__construct($accountName, $accountKey, $usePathStyleUri);
+        $this->_permissionSet = $permissionSet;
+    }
+    
+    /**
+     * Get permission set
+     *
+     * @return array
+     */
     public function getPermissionSet()
-	{
-	    return $this->_permissionSet;
-	}
-	
-	/**
-	 * Set permisison set
-	 *
-	 * Warning: fine-grained permissions should be added prior to coarse-grained permissions.
-	 * For example: first add blob permissions, end with container-wide permissions.
-	 *
-	 * Warning: the signed access signature URL must match the account name of the
-	 * Zend_Service_WindowsAzure_Credentials_Zend_Service_WindowsAzure_Credentials_SharedAccessSignature instance
-	 *
-	 * @param  array $value Permission set
-	 * @return void
-	 */
+    {
+        return $this->_permissionSet;
+    }
+    
+    /**
+     * Set permisison set
+     *
+     * Warning: fine-grained permissions should be added prior to coarse-grained permissions.
+     * For example: first add blob permissions, end with container-wide permissions.
+     *
+     * Warning: the signed access signature URL must match the account name of the
+     * Zend_Service_WindowsAzure_Credentials_Zend_Service_WindowsAzure_Credentials_SharedAccessSignature instance
+     *
+     * @param  array $value Permission set
+     * @return void
+     */
     public function setPermissionSet($value = array())
-	{
-		foreach ($value as $url) {
-			if (strpos($url, $this->_accountName) === false) {
-				throw new Zend_Service_WindowsAzure_Exception('The permission set can only contain URLs for the account name specified in the Zend_Service_WindowsAzure_Credentials_SharedAccessSignature instance.');
-			}
-		}
-	    $this->_permissionSet = $value;
-	}
+    {
+        foreach ($value as $url) {
+            if (strpos($url, $this->_accountName) === false) {
+                throw new Zend_Service_WindowsAzure_Exception('The permission set can only contain URLs for the account name specified in the Zend_Service_WindowsAzure_Credentials_SharedAccessSignature instance.');
+            }
+        }
+        $this->_permissionSet = $value;
+    }
 
     /**
      * Create signature
      *
-     * @param string $path 		   Path for the request
+     * @param string $path            Path for the request
      * @param string $resource     Signed resource - container (c) - blob (b)
      * @param string $permissions  Signed permissions - read (r), write (w), delete (d) and list (l)
      * @param string $start        The time at which the Shared Access Signature becomes valid.
@@ -111,48 +111,48 @@ class Zend_Service_WindowsAzure_Credentials_SharedAccessSignature
      * @return string
      */
     public function createSignature(
-    	$path = '/',
-    	$resource = 'b',
-    	$permissions = 'r',
-    	$start = '',
-    	$expiry = '',
-    	$identifier = ''
+        $path = '/',
+        $resource = 'b',
+        $permissions = 'r',
+        $start = '',
+        $expiry = '',
+        $identifier = ''
     ) {
-		// Determine path
-		if ($this->_usePathStyleUri) {
-			$path = substr($path, strpos($path, '/'));
-		}
-			
-		// Add trailing slash to $path
-		if (substr($path, 0, 1) !== '/') {
-		    $path = '/' . $path;
-		}
+        // Determine path
+        if ($this->_usePathStyleUri) {
+            $path = substr($path, strpos($path, '/'));
+        }
+            
+        // Add trailing slash to $path
+        if (substr($path, 0, 1) !== '/') {
+            $path = '/' . $path;
+        }
 
-		// Build canonicalized resource string
-		$canonicalizedResource  = '/' . $this->_accountName;
-		/*if ($this->_usePathStyleUri) {
-			$canonicalizedResource .= '/' . $this->_accountName;
-		}*/
-		$canonicalizedResource .= $path;
-		
-		// Create string to sign
-		$stringToSign   = array();
-		$stringToSign[] = $permissions;
-    	$stringToSign[] = $start;
-    	$stringToSign[] = $expiry;
-    	$stringToSign[] = $canonicalizedResource;
-    	$stringToSign[] = $identifier;
+        // Build canonicalized resource string
+        $canonicalizedResource  = '/' . $this->_accountName;
+        /*if ($this->_usePathStyleUri) {
+            $canonicalizedResource .= '/' . $this->_accountName;
+        }*/
+        $canonicalizedResource .= $path;
+        
+        // Create string to sign
+        $stringToSign   = array();
+        $stringToSign[] = $permissions;
+        $stringToSign[] = $start;
+        $stringToSign[] = $expiry;
+        $stringToSign[] = $canonicalizedResource;
+        $stringToSign[] = $identifier;
 
-    	$stringToSign = implode("\n", $stringToSign);
-    	$signature    = base64_encode(hash_hmac('sha256', $stringToSign, $this->_accountKey, true));
-	
-    	return $signature;
+        $stringToSign = implode("\n", $stringToSign);
+        $signature    = base64_encode(hash_hmac('sha256', $stringToSign, $this->_accountKey, true));
+    
+        return $signature;
     }
 
     /**
      * Create signed query string
      *
-     * @param string $path 		   Path for the request
+     * @param string $path            Path for the request
      * @param string $queryString  Query string for the request
      * @param string $resource     Signed resource - container (c) - blob (b)
      * @param string $permissions  Signed permissions - read (r), write (w), delete (d) and list (l)
@@ -162,13 +162,13 @@ class Zend_Service_WindowsAzure_Credentials_SharedAccessSignature
      * @return string
      */
     public function createSignedQueryString(
-    	$path = '/',
-    	$queryString = '',
-    	$resource = 'b',
-    	$permissions = 'r',
-    	$start = '',
-    	$expiry = '',
-    	$identifier = ''
+        $path = '/',
+        $queryString = '',
+        $resource = 'b',
+        $permissions = 'r',
+        $start = '',
+        $expiry = '',
+        $identifier = ''
     ) {
         // Parts
         $parts = array();
@@ -186,26 +186,26 @@ class Zend_Service_WindowsAzure_Credentials_SharedAccessSignature
         // Assemble parts and query string
         if ($queryString != '') {
             $queryString .= '&';
-	    }
+        }
         $queryString .= implode('&', $parts);
 
         return $queryString;
     }
 
     /**
-	 * Permission matches request?
-	 *
-	 * @param string $permissionUrl Permission URL
-	 * @param string $requestUrl Request URL
-	 * @param string $resourceType Resource type
-	 * @param string $requiredPermission Required permission
-	 * @return string Signed request URL
-	 */
+     * Permission matches request?
+     *
+     * @param string $permissionUrl Permission URL
+     * @param string $requestUrl Request URL
+     * @param string $resourceType Resource type
+     * @param string $requiredPermission Required permission
+     * @return string Signed request URL
+     */
     public function permissionMatchesRequest(
-    	$permissionUrl = '',
-    	$requestUrl = '',
-    	$resourceType = Zend_Service_WindowsAzure_Storage::RESOURCE_UNKNOWN,
-    	$requiredPermission = Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PERMISSION_READ
+        $permissionUrl = '',
+        $requestUrl = '',
+        $resourceType = Zend_Service_WindowsAzure_Storage::RESOURCE_UNKNOWN,
+        $requiredPermission = Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PERMISSION_READ
     ) {
         // Build requirements
         $requiredResourceType = $resourceType;
@@ -214,94 +214,94 @@ class Zend_Service_WindowsAzure_Credentials_SharedAccessSignature
         }
 
         // Parse permission url
-	    $parsedPermissionUrl = parse_url($permissionUrl);
-	
-	    // Parse permission properties
-	    $permissionParts = explode('&', $parsedPermissionUrl['query']);
-	
-	    // Parse request url
-	    $parsedRequestUrl = parse_url($requestUrl);
-	
-	    // Check if permission matches request
-	    $matches = true;
-	    foreach ($permissionParts as $part) {
-	        list($property, $value) = explode('=', $part, 2);
-	
-	        if ($property == 'sr') {
-	            $matches = $matches && (strpbrk($value, $requiredResourceType) !== false);
-	        }
-	
-	    	if ($property == 'sp') {
-	            $matches = $matches && (strpbrk($value, $requiredPermission) !== false);
-	        }
-	    }
-	
-	    // Ok, but... does the resource match?
-	    $matches = $matches && (strpos($parsedRequestUrl['path'], $parsedPermissionUrl['path']) !== false);
-	
+        $parsedPermissionUrl = parse_url($permissionUrl);
+    
+        // Parse permission properties
+        $permissionParts = explode('&', $parsedPermissionUrl['query']);
+    
+        // Parse request url
+        $parsedRequestUrl = parse_url($requestUrl);
+    
+        // Check if permission matches request
+        $matches = true;
+        foreach ($permissionParts as $part) {
+            list($property, $value) = explode('=', $part, 2);
+    
+            if ($property == 'sr') {
+                $matches = $matches && (strpbrk($value, $requiredResourceType) !== false);
+            }
+    
+            if ($property == 'sp') {
+                $matches = $matches && (strpbrk($value, $requiredPermission) !== false);
+            }
+        }
+    
+        // Ok, but... does the resource match?
+        $matches = $matches && (strpos($parsedRequestUrl['path'], $parsedPermissionUrl['path']) !== false);
+    
         // Return
-	    return $matches;
+        return $matches;
     }
 
     /**
-	 * Sign request URL with credentials
-	 *
-	 * @param string $requestUrl Request URL
-	 * @param string $resourceType Resource type
-	 * @param string $requiredPermission Required permission
-	 * @return string Signed request URL
-	 */
-	public function signRequestUrl(
-		$requestUrl = '',
-		$resourceType = Zend_Service_WindowsAzure_Storage::RESOURCE_UNKNOWN,
-		$requiredPermission = Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PERMISSION_READ
-	) {
-	    // Look for a matching permission
-	    foreach ($this->getPermissionSet() as $permittedUrl) {
-	        if ($this->permissionMatchesRequest($permittedUrl, $requestUrl, $resourceType, $requiredPermission)) {
-	            // This matches, append signature data
-	            $parsedPermittedUrl = parse_url($permittedUrl);
+     * Sign request URL with credentials
+     *
+     * @param string $requestUrl Request URL
+     * @param string $resourceType Resource type
+     * @param string $requiredPermission Required permission
+     * @return string Signed request URL
+     */
+    public function signRequestUrl(
+        $requestUrl = '',
+        $resourceType = Zend_Service_WindowsAzure_Storage::RESOURCE_UNKNOWN,
+        $requiredPermission = Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PERMISSION_READ
+    ) {
+        // Look for a matching permission
+        foreach ($this->getPermissionSet() as $permittedUrl) {
+            if ($this->permissionMatchesRequest($permittedUrl, $requestUrl, $resourceType, $requiredPermission)) {
+                // This matches, append signature data
+                $parsedPermittedUrl = parse_url($permittedUrl);
 
-	            if (strpos($requestUrl, '?') === false) {
-	                $requestUrl .= '?';
-	            } else {
-	                $requestUrl .= '&';
-	            }
-	
-	            $requestUrl .= $parsedPermittedUrl['query'];
+                if (strpos($requestUrl, '?') === false) {
+                    $requestUrl .= '?';
+                } else {
+                    $requestUrl .= '&';
+                }
+    
+                $requestUrl .= $parsedPermittedUrl['query'];
 
-	            // Return url
-	            return $requestUrl;
-	        }
-	    }
-	
-	    // Return url, will be unsigned...
-	    return $requestUrl;
-	}
+                // Return url
+                return $requestUrl;
+            }
+        }
+    
+        // Return url, will be unsigned...
+        return $requestUrl;
+    }
 
-	/**
-	 * Sign request with credentials
-	 *
-	 * @param string $httpVerb HTTP verb the request will use
-	 * @param string $path Path for the request
-	 * @param string $queryString Query string for the request
-	 * @param array $headers x-ms headers to add
-	 * @param boolean $forTableStorage Is the request for table storage?
-	 * @param string $resourceType Resource type
-	 * @param string $requiredPermission Required permission
-	 * @param mixed  $rawData Raw post data
-	 * @return array Array of headers
-	 */
-	public function signRequestHeaders(
-		$httpVerb = Zend_Http_Client::GET,
-		$path = '/',
-		$queryString = '',
-		$headers = null,
-		$forTableStorage = false,
-		$resourceType = Zend_Service_WindowsAzure_Storage::RESOURCE_UNKNOWN,
-		$requiredPermission = Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PERMISSION_READ,
-		$rawData = null
-	) {
-	    return $headers;
-	}
+    /**
+     * Sign request with credentials
+     *
+     * @param string $httpVerb HTTP verb the request will use
+     * @param string $path Path for the request
+     * @param string $queryString Query string for the request
+     * @param array $headers x-ms headers to add
+     * @param boolean $forTableStorage Is the request for table storage?
+     * @param string $resourceType Resource type
+     * @param string $requiredPermission Required permission
+     * @param mixed  $rawData Raw post data
+     * @return array Array of headers
+     */
+    public function signRequestHeaders(
+        $httpVerb = Zend_Http_Client::GET,
+        $path = '/',
+        $queryString = '',
+        $headers = null,
+        $forTableStorage = false,
+        $resourceType = Zend_Service_WindowsAzure_Storage::RESOURCE_UNKNOWN,
+        $requiredPermission = Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PERMISSION_READ,
+        $rawData = null
+    ) {
+        return $headers;
+    }
 }

+ 129 - 129
library/Zend/Service/WindowsAzure/Credentials/SharedKey.php

@@ -49,139 +49,139 @@ class Zend_Service_WindowsAzure_Credentials_SharedKey
     extends Zend_Service_WindowsAzure_Credentials_CredentialsAbstract
 {
     /**
-	 * Sign request URL with credentials
-	 *
-	 * @param string $requestUrl Request URL
-	 * @param string $resourceType Resource type
-	 * @param string $requiredPermission Required permission
-	 * @return string Signed request URL
-	 */
-	public function signRequestUrl(
-		$requestUrl = '',
-		$resourceType = Zend_Service_WindowsAzure_Storage::RESOURCE_UNKNOWN,
-		$requiredPermission = Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PERMISSION_READ
-	) {
-	    return $requestUrl;
-	}
-	
-	/**
-	 * Sign request headers with credentials
-	 *
-	 * @param string $httpVerb HTTP verb the request will use
-	 * @param string $path Path for the request
-	 * @param string $queryString Query string for the request
-	 * @param array $headers x-ms headers to add
-	 * @param boolean $forTableStorage Is the request for table storage?
-	 * @param string $resourceType Resource type
-	 * @param string $requiredPermission Required permission
-	 * @param mixed  $rawData Raw post data
-	 * @return array Array of headers
-	 */
-	public function signRequestHeaders(
-		$httpVerb = Zend_Http_Client::GET,
-		$path = '/',
-		$queryString = '',
-		$headers = null,
-		$forTableStorage = false,
-		$resourceType = Zend_Service_WindowsAzure_Storage::RESOURCE_UNKNOWN,
-		$requiredPermission = Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PERMISSION_READ,
-		$rawData = null
-	) {
-		// http://github.com/sriramk/winazurestorage/blob/214010a2f8931bac9c96dfeb337d56fe084ca63b/winazurestorage.py
+     * Sign request URL with credentials
+     *
+     * @param string $requestUrl Request URL
+     * @param string $resourceType Resource type
+     * @param string $requiredPermission Required permission
+     * @return string Signed request URL
+     */
+    public function signRequestUrl(
+        $requestUrl = '',
+        $resourceType = Zend_Service_WindowsAzure_Storage::RESOURCE_UNKNOWN,
+        $requiredPermission = Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PERMISSION_READ
+    ) {
+        return $requestUrl;
+    }
+    
+    /**
+     * Sign request headers with credentials
+     *
+     * @param string $httpVerb HTTP verb the request will use
+     * @param string $path Path for the request
+     * @param string $queryString Query string for the request
+     * @param array $headers x-ms headers to add
+     * @param boolean $forTableStorage Is the request for table storage?
+     * @param string $resourceType Resource type
+     * @param string $requiredPermission Required permission
+     * @param mixed  $rawData Raw post data
+     * @return array Array of headers
+     */
+    public function signRequestHeaders(
+        $httpVerb = Zend_Http_Client::GET,
+        $path = '/',
+        $queryString = '',
+        $headers = null,
+        $forTableStorage = false,
+        $resourceType = Zend_Service_WindowsAzure_Storage::RESOURCE_UNKNOWN,
+        $requiredPermission = Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PERMISSION_READ,
+        $rawData = null
+    ) {
+        // http://github.com/sriramk/winazurestorage/blob/214010a2f8931bac9c96dfeb337d56fe084ca63b/winazurestorage.py
 
-		// Table storage?
-		if ($forTableStorage) {
-			throw new Zend_Service_WindowsAzure_Credentials_Exception('The Windows Azure SDK for PHP does not support SharedKey authentication on table storage. Use SharedKeyLite authentication instead.');
-		}
-		
-		// Determine path
-		if ($this->_usePathStyleUri) {
-			$path = substr($path, strpos($path, '/'));
-		}
+        // Table storage?
+        if ($forTableStorage) {
+            throw new Zend_Service_WindowsAzure_Credentials_Exception('The Windows Azure SDK for PHP does not support SharedKey authentication on table storage. Use SharedKeyLite authentication instead.');
+        }
+        
+        // Determine path
+        if ($this->_usePathStyleUri) {
+            $path = substr($path, strpos($path, '/'));
+        }
 
-		// Determine query
-		$queryString = $this->_prepareQueryStringForSigning($queryString);
-	
-		// Canonicalized headers
-		$canonicalizedHeaders = array();
-		
-		// Request date
-		$requestDate = '';
-		if (isset($headers[Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PREFIX_STORAGE_HEADER . 'date'])) {
-		    $requestDate = $headers[Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PREFIX_STORAGE_HEADER . 'date'];
-		} else {
-		    $requestDate = gmdate('D, d M Y H:i:s', time()) . ' GMT'; // RFC 1123
-		    $canonicalizedHeaders[] = Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PREFIX_STORAGE_HEADER . 'date:' . $requestDate;
-		}
-		
-		// Build canonicalized headers
-		if ($headers !== null) {
-			foreach ($headers as $header => $value) {
-				if (is_bool($value)) {
-					$value = $value === true ? 'True' : 'False';
-				}
+        // Determine query
+        $queryString = $this->_prepareQueryStringForSigning($queryString);
+    
+        // Canonicalized headers
+        $canonicalizedHeaders = array();
+        
+        // Request date
+        $requestDate = '';
+        if (isset($headers[Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PREFIX_STORAGE_HEADER . 'date'])) {
+            $requestDate = $headers[Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PREFIX_STORAGE_HEADER . 'date'];
+        } else {
+            $requestDate = gmdate('D, d M Y H:i:s', time()) . ' GMT'; // RFC 1123
+            $canonicalizedHeaders[] = Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PREFIX_STORAGE_HEADER . 'date:' . $requestDate;
+        }
+        
+        // Build canonicalized headers
+        if ($headers !== null) {
+            foreach ($headers as $header => $value) {
+                if (is_bool($value)) {
+                    $value = $value === true ? 'True' : 'False';
+                }
 
-				$headers[$header] = $value;
-				if (substr($header, 0, strlen(Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PREFIX_STORAGE_HEADER)) == Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PREFIX_STORAGE_HEADER) {
-				    $canonicalizedHeaders[] = strtolower($header) . ':' . $value;
-				}
-			}
-		}
-		sort($canonicalizedHeaders);
+                $headers[$header] = $value;
+                if (substr($header, 0, strlen(Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PREFIX_STORAGE_HEADER)) == Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PREFIX_STORAGE_HEADER) {
+                    $canonicalizedHeaders[] = strtolower($header) . ':' . $value;
+                }
+            }
+        }
+        sort($canonicalizedHeaders);
 
-		// Build canonicalized resource string
-		$canonicalizedResource  = '/' . $this->_accountName;
-		if ($this->_usePathStyleUri) {
-			$canonicalizedResource .= '/' . $this->_accountName;
-		}
-		$canonicalizedResource .= $path;
-		if ($queryString !== '') {
-		    $queryStringItems = $this->_makeArrayOfQueryString($queryString);
-		    foreach ($queryStringItems as $key => $value) {
-		    	$canonicalizedResource .= "\n" . strtolower($key) . ':' . $value;
-		    }
-		}
-		
-		// Content-Length header
-		$contentLength = '';
-		if (strtoupper($httpVerb) != Zend_Http_Client::GET
-			 && strtoupper($httpVerb) != Zend_Http_Client::DELETE
-			 && strtoupper($httpVerb) != Zend_Http_Client::HEAD) {
-			$contentLength = 0;
-			
-			if ($rawData !== null) {
-				$contentLength = strlen($rawData);
-			}
-		}
+        // Build canonicalized resource string
+        $canonicalizedResource  = '/' . $this->_accountName;
+        if ($this->_usePathStyleUri) {
+            $canonicalizedResource .= '/' . $this->_accountName;
+        }
+        $canonicalizedResource .= $path;
+        if ($queryString !== '') {
+            $queryStringItems = $this->_makeArrayOfQueryString($queryString);
+            foreach ($queryStringItems as $key => $value) {
+                $canonicalizedResource .= "\n" . strtolower($key) . ':' . $value;
+            }
+        }
+        
+        // Content-Length header
+        $contentLength = '';
+        if (strtoupper($httpVerb) != Zend_Http_Client::GET
+             && strtoupper($httpVerb) != Zend_Http_Client::DELETE
+             && strtoupper($httpVerb) != Zend_Http_Client::HEAD) {
+            $contentLength = 0;
+            
+            if ($rawData !== null) {
+                $contentLength = strlen($rawData);
+            }
+        }
 
-		// Create string to sign
-		$stringToSign   = array();
-		$stringToSign[] = strtoupper($httpVerb); 									// VERB
-    	$stringToSign[] = $this->_issetOr($headers, 'Content-Encoding', '');		// Content-Encoding
-    	$stringToSign[] = $this->_issetOr($headers, 'Content-Language', '');		// Content-Language
-    	$stringToSign[] = $contentLength; 											// Content-Length
-    	$stringToSign[] = $this->_issetOr($headers, 'Content-MD5', '');				// Content-MD5
-    	$stringToSign[] = $this->_issetOr($headers, 'Content-Type', '');			// Content-Type
-    	$stringToSign[] = "";														// Date
-    	$stringToSign[] = $this->_issetOr($headers, 'If-Modified-Since', '');		// If-Modified-Since
-    	$stringToSign[] = $this->_issetOr($headers, 'If-Match', '');				// If-Match
-    	$stringToSign[] = $this->_issetOr($headers, 'If-None-Match', '');			// If-None-Match
-    	$stringToSign[] = $this->_issetOr($headers, 'If-Unmodified-Since', '');		// If-Unmodified-Since
-    	$stringToSign[] = $this->_issetOr($headers, 'Range', '');					// Range
-    	
-    	if (!$forTableStorage && count($canonicalizedHeaders) > 0) {
-    		$stringToSign[] = implode("\n", $canonicalizedHeaders); // Canonicalized headers
-    	}
-    		
-    	$stringToSign[] = $canonicalizedResource;		 			// Canonicalized resource
-    	$stringToSign   = implode("\n", $stringToSign);
-    	$signString     = base64_encode(hash_hmac('sha256', $stringToSign, $this->_accountKey, true));
+        // Create string to sign
+        $stringToSign   = array();
+        $stringToSign[] = strtoupper($httpVerb);                                     // VERB
+        $stringToSign[] = $this->_issetOr($headers, 'Content-Encoding', '');        // Content-Encoding
+        $stringToSign[] = $this->_issetOr($headers, 'Content-Language', '');        // Content-Language
+        $stringToSign[] = $contentLength;                                             // Content-Length
+        $stringToSign[] = $this->_issetOr($headers, 'Content-MD5', '');                // Content-MD5
+        $stringToSign[] = $this->_issetOr($headers, 'Content-Type', '');            // Content-Type
+        $stringToSign[] = "";                                                        // Date
+        $stringToSign[] = $this->_issetOr($headers, 'If-Modified-Since', '');        // If-Modified-Since
+        $stringToSign[] = $this->_issetOr($headers, 'If-Match', '');                // If-Match
+        $stringToSign[] = $this->_issetOr($headers, 'If-None-Match', '');            // If-None-Match
+        $stringToSign[] = $this->_issetOr($headers, 'If-Unmodified-Since', '');        // If-Unmodified-Since
+        $stringToSign[] = $this->_issetOr($headers, 'Range', '');                    // Range
+        
+        if (!$forTableStorage && count($canonicalizedHeaders) > 0) {
+            $stringToSign[] = implode("\n", $canonicalizedHeaders); // Canonicalized headers
+        }
+            
+        $stringToSign[] = $canonicalizedResource;                     // Canonicalized resource
+        $stringToSign   = implode("\n", $stringToSign);
+        $signString     = base64_encode(hash_hmac('sha256', $stringToSign, $this->_accountKey, true));
 
-    	// Sign request
-    	$headers[Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PREFIX_STORAGE_HEADER . 'date'] = $requestDate;
-    	$headers['Authorization'] = 'SharedKey ' . $this->_accountName . ':' . $signString;
-    	
-    	// Return headers
-    	return $headers;
-	}
+        // Sign request
+        $headers[Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PREFIX_STORAGE_HEADER . 'date'] = $requestDate;
+        $headers['Authorization'] = 'SharedKey ' . $this->_accountName . ':' . $signString;
+        
+        // Return headers
+        return $headers;
+    }
 }

+ 108 - 108
library/Zend/Service/WindowsAzure/Credentials/SharedKeyLite.php

@@ -49,118 +49,118 @@ class Zend_Service_WindowsAzure_Credentials_SharedKeyLite
     extends Zend_Service_WindowsAzure_Credentials_CredentialsAbstract
 {
     /**
-	 * Sign request URL with credentials
-	 *
-	 * @param string $requestUrl Request URL
-	 * @param string $resourceType Resource type
-	 * @param string $requiredPermission Required permission
-	 * @return string Signed request URL
-	 */
-	public function signRequestUrl(
-		$requestUrl = '',
-		$resourceType = Zend_Service_WindowsAzure_Storage::RESOURCE_UNKNOWN,
-		$requiredPermission = Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PERMISSION_READ
-	) {
-	    return $requestUrl;
-	}
-	
-	/**
-	 * Sign request headers with credentials
-	 *
-	 * @param string $httpVerb HTTP verb the request will use
-	 * @param string $path Path for the request
-	 * @param string $queryString Query string for the request
-	 * @param array $headers x-ms headers to add
-	 * @param boolean $forTableStorage Is the request for table storage?
-	 * @param string $resourceType Resource type
-	 * @param string $requiredPermission Required permission
-	 * @param mixed  $rawData Raw post data
-	 * @return array Array of headers
-	 */
-	public function signRequestHeaders(
-		$httpVerb = Zend_Http_Client::GET,
-		$path = '/',
-		$queryString = '',
-		$headers = null,
-		$forTableStorage = false,
-		$resourceType = Zend_Service_WindowsAzure_Storage::RESOURCE_UNKNOWN,
-		$requiredPermission = Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PERMISSION_READ,
-		$rawData = null
-	) {
-		// Table storage?
-		if (!$forTableStorage) {
-			throw new Zend_Service_WindowsAzure_Credentials_Exception('The Windows Azure SDK for PHP does not support SharedKeyLite authentication on blob or queue storage. Use SharedKey authentication instead.');
-		}
-		
-		// Determine path
-		if ($this->_usePathStyleUri) {
-			$path = substr($path, strpos($path, '/'));
-		}
+     * Sign request URL with credentials
+     *
+     * @param string $requestUrl Request URL
+     * @param string $resourceType Resource type
+     * @param string $requiredPermission Required permission
+     * @return string Signed request URL
+     */
+    public function signRequestUrl(
+        $requestUrl = '',
+        $resourceType = Zend_Service_WindowsAzure_Storage::RESOURCE_UNKNOWN,
+        $requiredPermission = Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PERMISSION_READ
+    ) {
+        return $requestUrl;
+    }
+    
+    /**
+     * Sign request headers with credentials
+     *
+     * @param string $httpVerb HTTP verb the request will use
+     * @param string $path Path for the request
+     * @param string $queryString Query string for the request
+     * @param array $headers x-ms headers to add
+     * @param boolean $forTableStorage Is the request for table storage?
+     * @param string $resourceType Resource type
+     * @param string $requiredPermission Required permission
+     * @param mixed  $rawData Raw post data
+     * @return array Array of headers
+     */
+    public function signRequestHeaders(
+        $httpVerb = Zend_Http_Client::GET,
+        $path = '/',
+        $queryString = '',
+        $headers = null,
+        $forTableStorage = false,
+        $resourceType = Zend_Service_WindowsAzure_Storage::RESOURCE_UNKNOWN,
+        $requiredPermission = Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PERMISSION_READ,
+        $rawData = null
+    ) {
+        // Table storage?
+        if (!$forTableStorage) {
+            throw new Zend_Service_WindowsAzure_Credentials_Exception('The Windows Azure SDK for PHP does not support SharedKeyLite authentication on blob or queue storage. Use SharedKey authentication instead.');
+        }
+        
+        // Determine path
+        if ($this->_usePathStyleUri) {
+            $path = substr($path, strpos($path, '/'));
+        }
 
-		// Determine query
-		$queryString = $this->_prepareQueryStringForSigning($queryString);
+        // Determine query
+        $queryString = $this->_prepareQueryStringForSigning($queryString);
 
-		// Build canonicalized resource string
-		$canonicalizedResource  = '/' . $this->_accountName;
-		if ($this->_usePathStyleUri) {
-			$canonicalizedResource .= '/' . $this->_accountName;
-		}
-		$canonicalizedResource .= $path;
-		if ($queryString !== '') {
-		    $canonicalizedResource .= $queryString;
-		}
+        // Build canonicalized resource string
+        $canonicalizedResource  = '/' . $this->_accountName;
+        if ($this->_usePathStyleUri) {
+            $canonicalizedResource .= '/' . $this->_accountName;
+        }
+        $canonicalizedResource .= $path;
+        if ($queryString !== '') {
+            $canonicalizedResource .= $queryString;
+        }
 
-		// Request date
-		$requestDate = '';
-		if (isset($headers[Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PREFIX_STORAGE_HEADER . 'date'])) {
-		    $requestDate = $headers[Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PREFIX_STORAGE_HEADER . 'date'];
-		} else {
-		    $requestDate = gmdate('D, d M Y H:i:s', time()) . ' GMT'; // RFC 1123
-		}
+        // Request date
+        $requestDate = '';
+        if (isset($headers[Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PREFIX_STORAGE_HEADER . 'date'])) {
+            $requestDate = $headers[Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PREFIX_STORAGE_HEADER . 'date'];
+        } else {
+            $requestDate = gmdate('D, d M Y H:i:s', time()) . ' GMT'; // RFC 1123
+        }
 
-		// Create string to sign
-		$stringToSign   = array();
-    	$stringToSign[] = $requestDate; // Date
-    	$stringToSign[] = $canonicalizedResource;		 			// Canonicalized resource
-    	$stringToSign   = implode("\n", $stringToSign);
-    	$signString     = base64_encode(hash_hmac('sha256', $stringToSign, $this->_accountKey, true));
+        // Create string to sign
+        $stringToSign   = array();
+        $stringToSign[] = $requestDate; // Date
+        $stringToSign[] = $canonicalizedResource;                     // Canonicalized resource
+        $stringToSign   = implode("\n", $stringToSign);
+        $signString     = base64_encode(hash_hmac('sha256', $stringToSign, $this->_accountKey, true));
 
-    	// Sign request
-    	$headers[Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PREFIX_STORAGE_HEADER . 'date'] = $requestDate;
-    	$headers['Authorization'] = 'SharedKeyLite ' . $this->_accountName . ':' . $signString;
-    	
-    	// Return headers
-    	return $headers;
-	}
-	
-	/**
-	 * Prepare query string for signing
-	 *
-	 * @param  string $value Original query string
-	 * @return string        Query string for signing
-	 */
-	protected function _prepareQueryStringForSigning($value)
-	{
-	    // Check for 'comp='
-	    if (strpos($value, 'comp=') === false) {
-	        // If not found, no query string needed
-	        return '';
-	    } else {
-	        // If found, make sure it is the only parameter being used
-    		if (strlen($value) > 0 && strpos($value, '?') === 0) {
-    			$value = substr($value, 1);
-    		}
-    		
-    		// Split parts
-    		$queryParts = explode('&', $value);
-    		foreach ($queryParts as $queryPart) {
-    		    if (strpos($queryPart, 'comp=') !== false) {
-    		        return '?' . $queryPart;
-    		    }
-    		}
+        // Sign request
+        $headers[Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PREFIX_STORAGE_HEADER . 'date'] = $requestDate;
+        $headers['Authorization'] = 'SharedKeyLite ' . $this->_accountName . ':' . $signString;
+        
+        // Return headers
+        return $headers;
+    }
+    
+    /**
+     * Prepare query string for signing
+     *
+     * @param  string $value Original query string
+     * @return string        Query string for signing
+     */
+    protected function _prepareQueryStringForSigning($value)
+    {
+        // Check for 'comp='
+        if (strpos($value, 'comp=') === false) {
+            // If not found, no query string needed
+            return '';
+        } else {
+            // If found, make sure it is the only parameter being used
+            if (strlen($value) > 0 && strpos($value, '?') === 0) {
+                $value = substr($value, 1);
+            }
+            
+            // Split parts
+            $queryParts = explode('&', $value);
+            foreach ($queryParts as $queryPart) {
+                if (strpos($queryPart, 'comp=') !== false) {
+                    return '?' . $queryPart;
+                }
+            }
 
-    		// Should never happen...
-			return '';
-	    }
-	}
+            // Should never happen...
+            return '';
+        }
+    }
 }

+ 15 - 15
library/Zend/Service/WindowsAzure/Diagnostics/ConfigurationDataSources.php

@@ -62,30 +62,30 @@ require_once 'Zend/Service/WindowsAzure/Diagnostics/ConfigurationDirectories.php
  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  *
- * @property	int																				OverallQuotaInMB				Overall quota in MB
- * @property	Zend_Service_WindowsAzure_Diagnostics_ConfigurationLogs							Logs							Logs
- * @property	Zend_Service_WindowsAzure_Diagnostics_ConfigurationDiagnosticInfrastructureLogs	DiagnosticInfrastructureLogs	Diagnostic infrastructure logs
- * @property	Zend_Service_WindowsAzure_Diagnostics_ConfigurationPerformanceCounters				PerformanceCounters				Performance counters
- * @property	Zend_Service_WindowsAzure_Diagnostics_ConfigurationWindowsEventLog					WindowsEventLog					Windows Event Log
- * @property	Zend_Service_WindowsAzure_Diagnostics_ConfigurationDirectories						Directories						Directories
+ * @property    int                                                                                OverallQuotaInMB                Overall quota in MB
+ * @property    Zend_Service_WindowsAzure_Diagnostics_ConfigurationLogs                            Logs                            Logs
+ * @property    Zend_Service_WindowsAzure_Diagnostics_ConfigurationDiagnosticInfrastructureLogs    DiagnosticInfrastructureLogs    Diagnostic infrastructure logs
+ * @property    Zend_Service_WindowsAzure_Diagnostics_ConfigurationPerformanceCounters                PerformanceCounters                Performance counters
+ * @property    Zend_Service_WindowsAzure_Diagnostics_ConfigurationWindowsEventLog                    WindowsEventLog                    Windows Event Log
+ * @property    Zend_Service_WindowsAzure_Diagnostics_ConfigurationDirectories                        Directories                        Directories
  */
 class Zend_Service_WindowsAzure_Diagnostics_ConfigurationDataSources
-	extends Zend_Service_WindowsAzure_Diagnostics_ConfigurationObjectBaseAbstract
+    extends Zend_Service_WindowsAzure_Diagnostics_ConfigurationObjectBaseAbstract
 {
     /**
      * Constructor
      *
-	 * @param	int	$overallQuotaInMB				Overall quota in MB
-	 */
+     * @param    int    $overallQuotaInMB                Overall quota in MB
+     */
     public function __construct($overallQuotaInMB = 0)
-    {	
+    {    
         $this->_data = array(
-            'overallquotainmb'        		=> $overallQuotaInMB,
-            'logs'             				=> new Zend_Service_WindowsAzure_Diagnostics_ConfigurationLogs(),
+            'overallquotainmb'                => $overallQuotaInMB,
+            'logs'                             => new Zend_Service_WindowsAzure_Diagnostics_ConfigurationLogs(),
             'diagnosticinfrastructurelogs'  => new Zend_Service_WindowsAzure_Diagnostics_ConfigurationDiagnosticInfrastructureLogs(),
-            'performancecounters'     		=> new Zend_Service_WindowsAzure_Diagnostics_ConfigurationPerformanceCounters(),
-            'windowseventlog'              	=> new Zend_Service_WindowsAzure_Diagnostics_ConfigurationWindowsEventLog(),
-            'directories'             		=> new Zend_Service_WindowsAzure_Diagnostics_ConfigurationDirectories()
+            'performancecounters'             => new Zend_Service_WindowsAzure_Diagnostics_ConfigurationPerformanceCounters(),
+            'windowseventlog'                  => new Zend_Service_WindowsAzure_Diagnostics_ConfigurationWindowsEventLog(),
+            'directories'                     => new Zend_Service_WindowsAzure_Diagnostics_ConfigurationDirectories()
         );
     }
 }

+ 12 - 12
library/Zend/Service/WindowsAzure/Diagnostics/ConfigurationDiagnosticInfrastructureLogs.php

@@ -42,26 +42,26 @@ require_once 'Zend/Service/WindowsAzure/Diagnostics/LogLevel.php';
  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  *
- * @property	int		BufferQuotaInMB						Buffer quota in MB
- * @property	int		ScheduledTransferPeriodInMinutes	Scheduled transfer period in minutes
- * @property	string	ScheduledTransferLogLevelFilter		Scheduled transfer log level filter
+ * @property    int        BufferQuotaInMB                        Buffer quota in MB
+ * @property    int        ScheduledTransferPeriodInMinutes    Scheduled transfer period in minutes
+ * @property    string    ScheduledTransferLogLevelFilter        Scheduled transfer log level filter
  */
 class Zend_Service_WindowsAzure_Diagnostics_ConfigurationDiagnosticInfrastructureLogs
-	extends Zend_Service_WindowsAzure_Diagnostics_ConfigurationObjectBaseAbstract
+    extends Zend_Service_WindowsAzure_Diagnostics_ConfigurationObjectBaseAbstract
 {
     /**
      * Constructor
      *
-	 * @param	int		$bufferQuotaInMB					Buffer quota in MB
-	 * @param	int		$scheduledTransferPeriodInMinutes	Scheduled transfer period in minutes
-	 * @param	string	$scheduledTransferLogLevelFilter	Scheduled transfer log level filter
-	 */
+     * @param    int        $bufferQuotaInMB                    Buffer quota in MB
+     * @param    int        $scheduledTransferPeriodInMinutes    Scheduled transfer period in minutes
+     * @param    string    $scheduledTransferLogLevelFilter    Scheduled transfer log level filter
+     */
     public function __construct($bufferQuotaInMB = 0, $scheduledTransferPeriodInMinutes = 0, $scheduledTransferLogLevelFilter = Zend_Service_WindowsAzure_Diagnostics_LogLevel::UNDEFINED)
-    {	
+    {    
         $this->_data = array(
-            'bufferquotainmb'        			=> $bufferQuotaInMB,
-            'scheduledtransferperiodinminutes' 	=> $scheduledTransferPeriodInMinutes,
-            'scheduledtransferloglevelfilter'	=> $scheduledTransferLogLevelFilter
+            'bufferquotainmb'                    => $bufferQuotaInMB,
+            'scheduledtransferperiodinminutes'     => $scheduledTransferPeriodInMinutes,
+            'scheduledtransferloglevelfilter'    => $scheduledTransferLogLevelFilter
         );
     }
 }

+ 27 - 27
library/Zend/Service/WindowsAzure/Diagnostics/ConfigurationDirectories.php

@@ -42,49 +42,49 @@ require_once 'Zend/Service/WindowsAzure/Diagnostics/DirectoryConfigurationSubscr
  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  *
- * @property	int		BufferQuotaInMB						Buffer quota in MB
- * @property	int		ScheduledTransferPeriodInMinutes	Scheduled transfer period in minutes
- * @property	array	Subscriptions						Subscriptions
+ * @property    int        BufferQuotaInMB                        Buffer quota in MB
+ * @property    int        ScheduledTransferPeriodInMinutes    Scheduled transfer period in minutes
+ * @property    array    Subscriptions                        Subscriptions
  */
 class Zend_Service_WindowsAzure_Diagnostics_ConfigurationDirectories
-	extends Zend_Service_WindowsAzure_Diagnostics_ConfigurationObjectBaseAbstract
+    extends Zend_Service_WindowsAzure_Diagnostics_ConfigurationObjectBaseAbstract
 {
     /**
      * Constructor
      *
-	 * @param	int		$bufferQuotaInMB					Buffer quota in MB
-	 * @param	int		$scheduledTransferPeriodInMinutes	Scheduled transfer period in minutes
-	 */
+     * @param    int        $bufferQuotaInMB                    Buffer quota in MB
+     * @param    int        $scheduledTransferPeriodInMinutes    Scheduled transfer period in minutes
+     */
     public function __construct($bufferQuotaInMB = 0, $scheduledTransferPeriodInMinutes = 0)
-    {	
+    {    
         $this->_data = array(
-            'bufferquotainmb'        			=> $bufferQuotaInMB,
-            'scheduledtransferperiodinminutes' 	=> $scheduledTransferPeriodInMinutes,
-        	'subscriptions'						=> array()
+            'bufferquotainmb'                    => $bufferQuotaInMB,
+            'scheduledtransferperiodinminutes'     => $scheduledTransferPeriodInMinutes,
+            'subscriptions'                        => array()
         );
     }
 
-	/**
-	 * Add subscription
-	 *
-	 * @param	string	$path					Path
-	 * @param	string	$container				Container
-	 * @param	int		$directoryQuotaInMB		Directory quota in MB
-	 */
+    /**
+     * Add subscription
+     *
+     * @param    string    $path                    Path
+     * @param    string    $container                Container
+     * @param    int        $directoryQuotaInMB        Directory quota in MB
+     */
     public function addSubscription($path, $container, $directoryQuotaInMB = 1024)
     {
-    	$this->_data['subscriptions'][$path] = new Zend_Service_WindowsAzure_Diagnostics_DirectoryConfigurationSubscription($path, $container, $directoryQuotaInMB);
+        $this->_data['subscriptions'][$path] = new Zend_Service_WindowsAzure_Diagnostics_DirectoryConfigurationSubscription($path, $container, $directoryQuotaInMB);
     }
 
-	/**
-	 * Remove subscription
-	 *
-	 * @param	string	$path					Path
-	 */
+    /**
+     * Remove subscription
+     *
+     * @param    string    $path                    Path
+     */
     public function removeSubscription($path)
     {
-    	if (isset($this->_data['subscriptions'][$path])) {
-    		unset($this->_data['subscriptions'][$path]);
-    	}
+        if (isset($this->_data['subscriptions'][$path])) {
+            unset($this->_data['subscriptions'][$path]);
+        }
     }
 }

+ 166 - 166
library/Zend/Service/WindowsAzure/Diagnostics/ConfigurationInstance.php

@@ -42,179 +42,179 @@ require_once 'Zend/Service/WindowsAzure/Diagnostics/ConfigurationDataSources.php
  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  *
- * @property Zend_Service_WindowsAzure_Diagnostics_ConfigurationDataSources	DataSources	Data sources
+ * @property Zend_Service_WindowsAzure_Diagnostics_ConfigurationDataSources    DataSources    Data sources
  */
 class Zend_Service_WindowsAzure_Diagnostics_ConfigurationInstance
-	extends Zend_Service_WindowsAzure_Diagnostics_ConfigurationObjectBaseAbstract
+    extends Zend_Service_WindowsAzure_Diagnostics_ConfigurationObjectBaseAbstract
 {
-	/**
-	 * Constructor
-	 */
-	public function __construct()
-	{
+    /**
+     * Constructor
+     */
+    public function __construct()
+    {
         $this->_data = array(
-            'datasources'	=> new Zend_Service_WindowsAzure_Diagnostics_ConfigurationDataSources()
+            'datasources'    => new Zend_Service_WindowsAzure_Diagnostics_ConfigurationDataSources()
         );
-	}
+    }
 
-	/**
-	 * Load configuration XML
-	 *
-	 * @param string $configurationXml Configuration XML
-	 */
-	public function loadXml($configurationXml)
-	{
-		// Convert to SimpleXMLElement
-		$configurationXml = simplexml_load_string($configurationXml);
-	
-		// Assign general settings
-		$this->DataSources->OverallQuotaInMB = (int)$configurationXml->DataSources->OverallQuotaInMB;
+    /**
+     * Load configuration XML
+     *
+     * @param string $configurationXml Configuration XML
+     */
+    public function loadXml($configurationXml)
+    {
+        // Convert to SimpleXMLElement
+        $configurationXml = simplexml_load_string($configurationXml);
+    
+        // Assign general settings
+        $this->DataSources->OverallQuotaInMB = (int)$configurationXml->DataSources->OverallQuotaInMB;
 
-		// Assign Logs settings	
-		$this->DataSources->Logs->BufferQuotaInMB = (int)$configurationXml->DataSources->Logs->BufferQuotaInMB;
-		$this->DataSources->Logs->ScheduledTransferPeriodInMinutes = (int)$configurationXml->DataSources->Logs->ScheduledTransferPeriodInMinutes;
-		$this->DataSources->Logs->ScheduledTransferLogLevelFilter = (string)$configurationXml->DataSources->Logs->ScheduledTransferLogLevelFilter;
+        // Assign Logs settings    
+        $this->DataSources->Logs->BufferQuotaInMB = (int)$configurationXml->DataSources->Logs->BufferQuotaInMB;
+        $this->DataSources->Logs->ScheduledTransferPeriodInMinutes = (int)$configurationXml->DataSources->Logs->ScheduledTransferPeriodInMinutes;
+        $this->DataSources->Logs->ScheduledTransferLogLevelFilter = (string)$configurationXml->DataSources->Logs->ScheduledTransferLogLevelFilter;
 
-		// Assign DiagnosticInfrastructureLogs settings
-		$this->DataSources->DiagnosticInfrastructureLogs->BufferQuotaInMB = (int)$configurationXml->DataSources->DiagnosticInfrastructureLogs->BufferQuotaInMB;
-		$this->DataSources->DiagnosticInfrastructureLogs->ScheduledTransferPeriodInMinutes = (int)$configurationXml->DataSources->DiagnosticInfrastructureLogs->ScheduledTransferPeriodInMinutes;
-		$this->DataSources->DiagnosticInfrastructureLogs->ScheduledTransferLogLevelFilter = (string)$configurationXml->DataSources->DiagnosticInfrastructureLogs->ScheduledTransferLogLevelFilter;
+        // Assign DiagnosticInfrastructureLogs settings
+        $this->DataSources->DiagnosticInfrastructureLogs->BufferQuotaInMB = (int)$configurationXml->DataSources->DiagnosticInfrastructureLogs->BufferQuotaInMB;
+        $this->DataSources->DiagnosticInfrastructureLogs->ScheduledTransferPeriodInMinutes = (int)$configurationXml->DataSources->DiagnosticInfrastructureLogs->ScheduledTransferPeriodInMinutes;
+        $this->DataSources->DiagnosticInfrastructureLogs->ScheduledTransferLogLevelFilter = (string)$configurationXml->DataSources->DiagnosticInfrastructureLogs->ScheduledTransferLogLevelFilter;
 
-		// Assign PerformanceCounters settings
-		$this->DataSources->PerformanceCounters->BufferQuotaInMB = (int)$configurationXml->DataSources->PerformanceCounters->BufferQuotaInMB;
-		$this->DataSources->PerformanceCounters->ScheduledTransferPeriodInMinutes = (int)$configurationXml->DataSources->PerformanceCounters->ScheduledTransferPeriodInMinutes;
-		if ($configurationXml->DataSources->PerformanceCounters->Subscriptions
-			&& $configurationXml->DataSources->PerformanceCounters->Subscriptions->PerformanceCounterConfiguration) {
-			$subscriptions = $configurationXml->DataSources->PerformanceCounters->Subscriptions;
-			if (count($subscriptions->PerformanceCounterConfiguration) > 1) {
-				$subscriptions = $subscriptions->PerformanceCounterConfiguration;
-			} else {
-				$subscriptions = array($subscriptions->PerformanceCounterConfiguration);
-			}
-			foreach ($subscriptions as $subscription) {
-				$this->DataSources->PerformanceCounters->addSubscription((string)$subscription->CounterSpecifier, (int)$subscription->SampleRateInSeconds);
-			}
-		}
-				
-		// Assign WindowsEventLog settings
-		$this->DataSources->WindowsEventLog->BufferQuotaInMB = (int)$configurationXml->DataSources->WindowsEventLog->BufferQuotaInMB;
-		$this->DataSources->WindowsEventLog->ScheduledTransferPeriodInMinutes = (int)$configurationXml->DataSources->WindowsEventLog->ScheduledTransferPeriodInMinutes;
-		$this->DataSources->WindowsEventLog->ScheduledTransferLogLevelFilter = (string)$configurationXml->DataSources->WindowsEventLog->ScheduledTransferLogLevelFilter;
-		if ($configurationXml->DataSources->WindowsEventLog->Subscriptions
-			&& $configurationXml->DataSources->WindowsEventLog->Subscriptions->string) {
-			$subscriptions = $configurationXml->DataSources->WindowsEventLog->Subscriptions;
-			if (count($subscriptions->string) > 1) {
-				$subscriptions = $subscriptions->string;
-			} else {
-				$subscriptions = array($subscriptions->string);
-			}
-			foreach ($subscriptions as $subscription) {
-				$this->DataSources->WindowsEventLog->addSubscription((string)$subscription);
-			}
-		}
-		
-		// Assign Directories settings
-		$this->DataSources->Directories->BufferQuotaInMB = (int)$configurationXml->DataSources->Directories->BufferQuotaInMB;
-		$this->DataSources->Directories->ScheduledTransferPeriodInMinutes = (int)$configurationXml->DataSources->Directories->ScheduledTransferPeriodInMinutes;
-		if ($configurationXml->DataSources->Directories->Subscriptions
-			&& $configurationXml->DataSources->Directories->Subscriptions->DirectoryConfiguration) {
-			$subscriptions = $configurationXml->DataSources->WindowsEventLog->Subscriptions;
-			if (count($subscriptions->DirectoryConfiguration) > 1) {
-				$subscriptions = $subscriptions->DirectoryConfiguration;
-			} else {
-				$subscriptions = array($subscriptions->DirectoryConfiguration);
-			}
-			foreach ($subscriptions as $subscription) {
-				$this->DataSources->Directories->addSubscription((string)$subscription->Path, (string)$subscription->Container, (int)$subscription->DirectoryQuotaInMB);
-			}
-		}
-	}
-	
-	/**
-	 * Create configuration XML
-	 *
-	 * @return string
-	 */
-	public function toXml()
-	{
-		// Return value
-		$returnValue = array();
-		
-		// Build XML
-		$returnValue[] = '<?xml version="1.0"?>';
-		$returnValue[] = '<ConfigRequest xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">';
-		
-		// Add data sources
-		$returnValue[] = '  <DataSources>';
-		
-		$returnValue[] = '    <OverallQuotaInMB>' . $this->DataSources->OverallQuotaInMB . '</OverallQuotaInMB>';
-		
-		$returnValue[] = '    <Logs>';
-		$returnValue[] = '      <BufferQuotaInMB>' . $this->DataSources->Logs->BufferQuotaInMB . '</BufferQuotaInMB>';
-		$returnValue[] = '      <ScheduledTransferPeriodInMinutes>' . $this->DataSources->Logs->ScheduledTransferPeriodInMinutes . '</ScheduledTransferPeriodInMinutes>';
-		$returnValue[] = '      <ScheduledTransferLogLevelFilter>' . $this->DataSources->Logs->ScheduledTransferLogLevelFilter . '</ScheduledTransferLogLevelFilter>';
-		$returnValue[] = '    </Logs>';
-		
-		$returnValue[] = '    <DiagnosticInfrastructureLogs>';
-		$returnValue[] = '      <BufferQuotaInMB>' . $this->DataSources->DiagnosticInfrastructureLogs->BufferQuotaInMB . '</BufferQuotaInMB>';
-		$returnValue[] = '      <ScheduledTransferPeriodInMinutes>' . $this->DataSources->DiagnosticInfrastructureLogs->ScheduledTransferPeriodInMinutes . '</ScheduledTransferPeriodInMinutes>';
-		$returnValue[] = '      <ScheduledTransferLogLevelFilter>' . $this->DataSources->DiagnosticInfrastructureLogs->ScheduledTransferLogLevelFilter . '</ScheduledTransferLogLevelFilter>';
-		$returnValue[] = '    </DiagnosticInfrastructureLogs>';
-		
-		$returnValue[] = '    <PerformanceCounters>';
-		$returnValue[] = '      <BufferQuotaInMB>' . $this->DataSources->PerformanceCounters->BufferQuotaInMB . '</BufferQuotaInMB>';
-		$returnValue[] = '      <ScheduledTransferPeriodInMinutes>' . $this->DataSources->PerformanceCounters->ScheduledTransferPeriodInMinutes . '</ScheduledTransferPeriodInMinutes>';
-		if (count($this->DataSources->PerformanceCounters->Subscriptions) == 0) {
-			$returnValue[] = '      <Subscriptions />';
-		} else {
-			$returnValue[] = '      <Subscriptions>';
-			foreach ($this->DataSources->PerformanceCounters->Subscriptions as $subscription) {
-				$returnValue[] = '        <PerformanceCounterConfiguration>';
-				$returnValue[] = '          <CounterSpecifier>' . $subscription->CounterSpecifier . '</CounterSpecifier>';
-				$returnValue[] = '          <SampleRateInSeconds>' . $subscription->SampleRateInSeconds . '</SampleRateInSeconds>';
-				$returnValue[] = '        </PerformanceCounterConfiguration>';
-			}
-			$returnValue[] = '      </Subscriptions>';
-		}
-		$returnValue[] = '    </PerformanceCounters>';
-		
-		$returnValue[] = '    <WindowsEventLog>';
-		$returnValue[] = '      <BufferQuotaInMB>' . $this->DataSources->WindowsEventLog->BufferQuotaInMB . '</BufferQuotaInMB>';
-		$returnValue[] = '      <ScheduledTransferPeriodInMinutes>' . $this->DataSources->WindowsEventLog->ScheduledTransferPeriodInMinutes . '</ScheduledTransferPeriodInMinutes>';
-			if (count($this->DataSources->WindowsEventLog->Subscriptions) == 0) {
-			$returnValue[] = '      <Subscriptions />';
-		} else {
-			$returnValue[] = '      <Subscriptions>';
-			foreach ($this->DataSources->WindowsEventLog->Subscriptions as $subscription) {
-				$returnValue[] = '      <string>' . $subscription . '</string>';
-			}
-			$returnValue[] = '      </Subscriptions>';
-		}
-		$returnValue[] = '      <ScheduledTransferLogLevelFilter>' . $this->DataSources->WindowsEventLog->ScheduledTransferLogLevelFilter . '</ScheduledTransferLogLevelFilter>';
-		$returnValue[] = '    </WindowsEventLog>';
-		
-		$returnValue[] = '    <Directories>';
-		$returnValue[] = '      <BufferQuotaInMB>' . $this->DataSources->Directories->BufferQuotaInMB . '</BufferQuotaInMB>';
-		$returnValue[] = '      <ScheduledTransferPeriodInMinutes>' . $this->DataSources->Directories->ScheduledTransferPeriodInMinutes . '</ScheduledTransferPeriodInMinutes>';
-		if (count($this->DataSources->Directories->Subscriptions) == 0) {
-			$returnValue[] = '      <Subscriptions />';
-		} else {
-			$returnValue[] = '      <Subscriptions>';
-			foreach ($this->DataSources->Directories->Subscriptions as $subscription) {
-				$returnValue[] = '        <DirectoryConfiguration>';
-				$returnValue[] = '          <Path>' . $subscription->Path . '</Path>';
-				$returnValue[] = '          <Container>' . $subscription->Container . '</Container>';
-				$returnValue[] = '          <DirectoryQuotaInMB>' . $subscription->DirectoryQuotaInMB . '</DirectoryQuotaInMB>';
-				$returnValue[] = '        </DirectoryConfiguration>';
-			}
-			$returnValue[] = '      </Subscriptions>';
-		}
-		$returnValue[] = '    </Directories>';
-		
-		$returnValue[] = '  </DataSources>';
-		$returnValue[] = '</ConfigRequest>';
-		
-		// Return
-		return implode("\r\n", $returnValue);
-	}
+        // Assign PerformanceCounters settings
+        $this->DataSources->PerformanceCounters->BufferQuotaInMB = (int)$configurationXml->DataSources->PerformanceCounters->BufferQuotaInMB;
+        $this->DataSources->PerformanceCounters->ScheduledTransferPeriodInMinutes = (int)$configurationXml->DataSources->PerformanceCounters->ScheduledTransferPeriodInMinutes;
+        if ($configurationXml->DataSources->PerformanceCounters->Subscriptions
+            && $configurationXml->DataSources->PerformanceCounters->Subscriptions->PerformanceCounterConfiguration) {
+            $subscriptions = $configurationXml->DataSources->PerformanceCounters->Subscriptions;
+            if (count($subscriptions->PerformanceCounterConfiguration) > 1) {
+                $subscriptions = $subscriptions->PerformanceCounterConfiguration;
+            } else {
+                $subscriptions = array($subscriptions->PerformanceCounterConfiguration);
+            }
+            foreach ($subscriptions as $subscription) {
+                $this->DataSources->PerformanceCounters->addSubscription((string)$subscription->CounterSpecifier, (int)$subscription->SampleRateInSeconds);
+            }
+        }
+                
+        // Assign WindowsEventLog settings
+        $this->DataSources->WindowsEventLog->BufferQuotaInMB = (int)$configurationXml->DataSources->WindowsEventLog->BufferQuotaInMB;
+        $this->DataSources->WindowsEventLog->ScheduledTransferPeriodInMinutes = (int)$configurationXml->DataSources->WindowsEventLog->ScheduledTransferPeriodInMinutes;
+        $this->DataSources->WindowsEventLog->ScheduledTransferLogLevelFilter = (string)$configurationXml->DataSources->WindowsEventLog->ScheduledTransferLogLevelFilter;
+        if ($configurationXml->DataSources->WindowsEventLog->Subscriptions
+            && $configurationXml->DataSources->WindowsEventLog->Subscriptions->string) {
+            $subscriptions = $configurationXml->DataSources->WindowsEventLog->Subscriptions;
+            if (count($subscriptions->string) > 1) {
+                $subscriptions = $subscriptions->string;
+            } else {
+                $subscriptions = array($subscriptions->string);
+            }
+            foreach ($subscriptions as $subscription) {
+                $this->DataSources->WindowsEventLog->addSubscription((string)$subscription);
+            }
+        }
+        
+        // Assign Directories settings
+        $this->DataSources->Directories->BufferQuotaInMB = (int)$configurationXml->DataSources->Directories->BufferQuotaInMB;
+        $this->DataSources->Directories->ScheduledTransferPeriodInMinutes = (int)$configurationXml->DataSources->Directories->ScheduledTransferPeriodInMinutes;
+        if ($configurationXml->DataSources->Directories->Subscriptions
+            && $configurationXml->DataSources->Directories->Subscriptions->DirectoryConfiguration) {
+            $subscriptions = $configurationXml->DataSources->WindowsEventLog->Subscriptions;
+            if (count($subscriptions->DirectoryConfiguration) > 1) {
+                $subscriptions = $subscriptions->DirectoryConfiguration;
+            } else {
+                $subscriptions = array($subscriptions->DirectoryConfiguration);
+            }
+            foreach ($subscriptions as $subscription) {
+                $this->DataSources->Directories->addSubscription((string)$subscription->Path, (string)$subscription->Container, (int)$subscription->DirectoryQuotaInMB);
+            }
+        }
+    }
+    
+    /**
+     * Create configuration XML
+     *
+     * @return string
+     */
+    public function toXml()
+    {
+        // Return value
+        $returnValue = array();
+        
+        // Build XML
+        $returnValue[] = '<?xml version="1.0"?>';
+        $returnValue[] = '<ConfigRequest xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">';
+        
+        // Add data sources
+        $returnValue[] = '  <DataSources>';
+        
+        $returnValue[] = '    <OverallQuotaInMB>' . $this->DataSources->OverallQuotaInMB . '</OverallQuotaInMB>';
+        
+        $returnValue[] = '    <Logs>';
+        $returnValue[] = '      <BufferQuotaInMB>' . $this->DataSources->Logs->BufferQuotaInMB . '</BufferQuotaInMB>';
+        $returnValue[] = '      <ScheduledTransferPeriodInMinutes>' . $this->DataSources->Logs->ScheduledTransferPeriodInMinutes . '</ScheduledTransferPeriodInMinutes>';
+        $returnValue[] = '      <ScheduledTransferLogLevelFilter>' . $this->DataSources->Logs->ScheduledTransferLogLevelFilter . '</ScheduledTransferLogLevelFilter>';
+        $returnValue[] = '    </Logs>';
+        
+        $returnValue[] = '    <DiagnosticInfrastructureLogs>';
+        $returnValue[] = '      <BufferQuotaInMB>' . $this->DataSources->DiagnosticInfrastructureLogs->BufferQuotaInMB . '</BufferQuotaInMB>';
+        $returnValue[] = '      <ScheduledTransferPeriodInMinutes>' . $this->DataSources->DiagnosticInfrastructureLogs->ScheduledTransferPeriodInMinutes . '</ScheduledTransferPeriodInMinutes>';
+        $returnValue[] = '      <ScheduledTransferLogLevelFilter>' . $this->DataSources->DiagnosticInfrastructureLogs->ScheduledTransferLogLevelFilter . '</ScheduledTransferLogLevelFilter>';
+        $returnValue[] = '    </DiagnosticInfrastructureLogs>';
+        
+        $returnValue[] = '    <PerformanceCounters>';
+        $returnValue[] = '      <BufferQuotaInMB>' . $this->DataSources->PerformanceCounters->BufferQuotaInMB . '</BufferQuotaInMB>';
+        $returnValue[] = '      <ScheduledTransferPeriodInMinutes>' . $this->DataSources->PerformanceCounters->ScheduledTransferPeriodInMinutes . '</ScheduledTransferPeriodInMinutes>';
+        if (count($this->DataSources->PerformanceCounters->Subscriptions) == 0) {
+            $returnValue[] = '      <Subscriptions />';
+        } else {
+            $returnValue[] = '      <Subscriptions>';
+            foreach ($this->DataSources->PerformanceCounters->Subscriptions as $subscription) {
+                $returnValue[] = '        <PerformanceCounterConfiguration>';
+                $returnValue[] = '          <CounterSpecifier>' . $subscription->CounterSpecifier . '</CounterSpecifier>';
+                $returnValue[] = '          <SampleRateInSeconds>' . $subscription->SampleRateInSeconds . '</SampleRateInSeconds>';
+                $returnValue[] = '        </PerformanceCounterConfiguration>';
+            }
+            $returnValue[] = '      </Subscriptions>';
+        }
+        $returnValue[] = '    </PerformanceCounters>';
+        
+        $returnValue[] = '    <WindowsEventLog>';
+        $returnValue[] = '      <BufferQuotaInMB>' . $this->DataSources->WindowsEventLog->BufferQuotaInMB . '</BufferQuotaInMB>';
+        $returnValue[] = '      <ScheduledTransferPeriodInMinutes>' . $this->DataSources->WindowsEventLog->ScheduledTransferPeriodInMinutes . '</ScheduledTransferPeriodInMinutes>';
+            if (count($this->DataSources->WindowsEventLog->Subscriptions) == 0) {
+            $returnValue[] = '      <Subscriptions />';
+        } else {
+            $returnValue[] = '      <Subscriptions>';
+            foreach ($this->DataSources->WindowsEventLog->Subscriptions as $subscription) {
+                $returnValue[] = '      <string>' . $subscription . '</string>';
+            }
+            $returnValue[] = '      </Subscriptions>';
+        }
+        $returnValue[] = '      <ScheduledTransferLogLevelFilter>' . $this->DataSources->WindowsEventLog->ScheduledTransferLogLevelFilter . '</ScheduledTransferLogLevelFilter>';
+        $returnValue[] = '    </WindowsEventLog>';
+        
+        $returnValue[] = '    <Directories>';
+        $returnValue[] = '      <BufferQuotaInMB>' . $this->DataSources->Directories->BufferQuotaInMB . '</BufferQuotaInMB>';
+        $returnValue[] = '      <ScheduledTransferPeriodInMinutes>' . $this->DataSources->Directories->ScheduledTransferPeriodInMinutes . '</ScheduledTransferPeriodInMinutes>';
+        if (count($this->DataSources->Directories->Subscriptions) == 0) {
+            $returnValue[] = '      <Subscriptions />';
+        } else {
+            $returnValue[] = '      <Subscriptions>';
+            foreach ($this->DataSources->Directories->Subscriptions as $subscription) {
+                $returnValue[] = '        <DirectoryConfiguration>';
+                $returnValue[] = '          <Path>' . $subscription->Path . '</Path>';
+                $returnValue[] = '          <Container>' . $subscription->Container . '</Container>';
+                $returnValue[] = '          <DirectoryQuotaInMB>' . $subscription->DirectoryQuotaInMB . '</DirectoryQuotaInMB>';
+                $returnValue[] = '        </DirectoryConfiguration>';
+            }
+            $returnValue[] = '      </Subscriptions>';
+        }
+        $returnValue[] = '    </Directories>';
+        
+        $returnValue[] = '  </DataSources>';
+        $returnValue[] = '</ConfigRequest>';
+        
+        // Return
+        return implode("\r\n", $returnValue);
+    }
 }

+ 12 - 12
library/Zend/Service/WindowsAzure/Diagnostics/ConfigurationLogs.php

@@ -42,26 +42,26 @@ require_once 'Zend/Service/WindowsAzure/Diagnostics/LogLevel.php';
  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  *
- * @property	int		BufferQuotaInMB						Buffer quota in MB
- * @property	int		ScheduledTransferPeriodInMinutes	Scheduled transfer period in minutes
- * @property	string	ScheduledTransferLogLevelFilter		Scheduled transfer log level filter
+ * @property    int        BufferQuotaInMB                        Buffer quota in MB
+ * @property    int        ScheduledTransferPeriodInMinutes    Scheduled transfer period in minutes
+ * @property    string    ScheduledTransferLogLevelFilter        Scheduled transfer log level filter
  */
 class Zend_Service_WindowsAzure_Diagnostics_ConfigurationLogs
-	extends Zend_Service_WindowsAzure_Diagnostics_ConfigurationObjectBaseAbstract
+    extends Zend_Service_WindowsAzure_Diagnostics_ConfigurationObjectBaseAbstract
 {
     /**
      * Constructor
      *
-	 * @param	int		$bufferQuotaInMB					Buffer quota in MB
-	 * @param	int		$scheduledTransferPeriodInMinutes	Scheduled transfer period in minutes
-	 * @param	string	$scheduledTransferLogLevelFilter	Scheduled transfer log level filter
-	 */
+     * @param    int        $bufferQuotaInMB                    Buffer quota in MB
+     * @param    int        $scheduledTransferPeriodInMinutes    Scheduled transfer period in minutes
+     * @param    string    $scheduledTransferLogLevelFilter    Scheduled transfer log level filter
+     */
     public function __construct($bufferQuotaInMB = 0, $scheduledTransferPeriodInMinutes = 0, $scheduledTransferLogLevelFilter = Zend_Service_WindowsAzure_Diagnostics_LogLevel::UNDEFINED)
-    {	
+    {    
         $this->_data = array(
-            'bufferquotainmb'        			=> $bufferQuotaInMB,
-            'scheduledtransferperiodinminutes' 	=> $scheduledTransferPeriodInMinutes,
-            'scheduledtransferloglevelfilter'	=> $scheduledTransferLogLevelFilter
+            'bufferquotainmb'                    => $bufferQuotaInMB,
+            'scheduledtransferperiodinminutes'     => $scheduledTransferPeriodInMinutes,
+            'scheduledtransferloglevelfilter'    => $scheduledTransferLogLevelFilter
         );
     }
 }

+ 26 - 26
library/Zend/Service/WindowsAzure/Diagnostics/ConfigurationPerformanceCounters.php

@@ -42,48 +42,48 @@ require_once 'Zend/Service/WindowsAzure/Diagnostics/PerformanceCounterSubscripti
  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  *
- * @property	int		BufferQuotaInMB						Buffer quota in MB
- * @property	int		ScheduledTransferPeriodInMinutes	Scheduled transfer period in minutes
- * @property	array	Subscriptions						Subscriptions
+ * @property    int        BufferQuotaInMB                        Buffer quota in MB
+ * @property    int        ScheduledTransferPeriodInMinutes    Scheduled transfer period in minutes
+ * @property    array    Subscriptions                        Subscriptions
  */
 class Zend_Service_WindowsAzure_Diagnostics_ConfigurationPerformanceCounters
-	extends Zend_Service_WindowsAzure_Diagnostics_ConfigurationObjectBaseAbstract
+    extends Zend_Service_WindowsAzure_Diagnostics_ConfigurationObjectBaseAbstract
 {
     /**
      * Constructor
      *
-	 * @param	int		$bufferQuotaInMB					Buffer quota in MB
-	 * @param	int		$scheduledTransferPeriodInMinutes	Scheduled transfer period in minutes
-	 */
+     * @param    int        $bufferQuotaInMB                    Buffer quota in MB
+     * @param    int        $scheduledTransferPeriodInMinutes    Scheduled transfer period in minutes
+     */
     public function __construct($bufferQuotaInMB = 0, $scheduledTransferPeriodInMinutes = 0)
-    {	
+    {    
         $this->_data = array(
-            'bufferquotainmb'        			=> $bufferQuotaInMB,
-            'scheduledtransferperiodinminutes' 	=> $scheduledTransferPeriodInMinutes,
-        	'subscriptions'						=> array()
+            'bufferquotainmb'                    => $bufferQuotaInMB,
+            'scheduledtransferperiodinminutes'     => $scheduledTransferPeriodInMinutes,
+            'subscriptions'                        => array()
         );
     }
 
-	/**
-	 * Add subscription
-	 *
- 	 * @param	string	$counterSpecifier					Counter specifier
- 	 * @param	int		$sampleRateInSeconds				Sample rate in seconds
-	 */
+    /**
+     * Add subscription
+     *
+      * @param    string    $counterSpecifier                    Counter specifier
+      * @param    int        $sampleRateInSeconds                Sample rate in seconds
+     */
     public function addSubscription($counterSpecifier, $sampleRateInSeconds = 1)
     {
-    	$this->_data['subscriptions'][$counterSpecifier] = new Zend_Service_WindowsAzure_Diagnostics_PerformanceCounterSubscription($counterSpecifier, $sampleRateInSeconds);
+        $this->_data['subscriptions'][$counterSpecifier] = new Zend_Service_WindowsAzure_Diagnostics_PerformanceCounterSubscription($counterSpecifier, $sampleRateInSeconds);
     }
 
-	/**
-	 * Remove subscription
-	 *
- 	 * @param	string	$counterSpecifier					Counter specifier
-	 */
+    /**
+     * Remove subscription
+     *
+      * @param    string    $counterSpecifier                    Counter specifier
+     */
     public function removeSubscription($counterSpecifier)
     {
-    	if (isset($this->_data['subscriptions'][$counterSpecifier])) {
-    		unset($this->_data['subscriptions'][$counterSpecifier]);
-    	}
+        if (isset($this->_data['subscriptions'][$counterSpecifier])) {
+            unset($this->_data['subscriptions'][$counterSpecifier]);
+        }
     }
 }

+ 28 - 28
library/Zend/Service/WindowsAzure/Diagnostics/ConfigurationWindowsEventLog.php

@@ -42,50 +42,50 @@ require_once 'Zend/Service/WindowsAzure/Diagnostics/LogLevel.php';
  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  *
- * @property	int		BufferQuotaInMB						Buffer quota in MB
- * @property	int		ScheduledTransferPeriodInMinutes	Scheduled transfer period in minutes
- * @property	string	ScheduledTransferLogLevelFilter		Scheduled transfer log level filter
- * @property	array	Subscriptions						Subscriptions
+ * @property    int        BufferQuotaInMB                        Buffer quota in MB
+ * @property    int        ScheduledTransferPeriodInMinutes    Scheduled transfer period in minutes
+ * @property    string    ScheduledTransferLogLevelFilter        Scheduled transfer log level filter
+ * @property    array    Subscriptions                        Subscriptions
  */
 class Zend_Service_WindowsAzure_Diagnostics_ConfigurationWindowsEventLog
-	extends Zend_Service_WindowsAzure_Diagnostics_ConfigurationObjectBaseAbstract
+    extends Zend_Service_WindowsAzure_Diagnostics_ConfigurationObjectBaseAbstract
 {
     /**
      * Constructor
      *
-	 * @param	int		$bufferQuotaInMB					Buffer quota in MB
-	 * @param	int		$scheduledTransferPeriodInMinutes	Scheduled transfer period in minutes
-	 * @param	string	$scheduledTransferLogLevelFilter	Scheduled transfer log level filter
-	 */
+     * @param    int        $bufferQuotaInMB                    Buffer quota in MB
+     * @param    int        $scheduledTransferPeriodInMinutes    Scheduled transfer period in minutes
+     * @param    string    $scheduledTransferLogLevelFilter    Scheduled transfer log level filter
+     */
     public function __construct($bufferQuotaInMB = 0, $scheduledTransferPeriodInMinutes = 0, $scheduledTransferLogLevelFilter = Zend_Service_WindowsAzure_Diagnostics_LogLevel::UNDEFINED)
-    {	
+    {    
         $this->_data = array(
-            'bufferquotainmb'        			=> $bufferQuotaInMB,
-            'scheduledtransferperiodinminutes' 	=> $scheduledTransferPeriodInMinutes,
-            'scheduledtransferloglevelfilter'	=> $scheduledTransferLogLevelFilter,
-        	'subscriptions'						=> array()
+            'bufferquotainmb'                    => $bufferQuotaInMB,
+            'scheduledtransferperiodinminutes'     => $scheduledTransferPeriodInMinutes,
+            'scheduledtransferloglevelfilter'    => $scheduledTransferLogLevelFilter,
+            'subscriptions'                        => array()
         );
     }
 
-	/**
-	 * Add subscription
-	 *
- 	 * @param	string	$filter	Event log filter
-	 */
+    /**
+     * Add subscription
+     *
+      * @param    string    $filter    Event log filter
+     */
     public function addSubscription($filter)
     {
-    	$this->_data['subscriptions'][$filter] = $filter;
+        $this->_data['subscriptions'][$filter] = $filter;
     }
 
-	/**
-	 * Remove subscription
-	 *
- 	 * @param	string	$filter	Event log filter
-	 */
+    /**
+     * Remove subscription
+     *
+      * @param    string    $filter    Event log filter
+     */
     public function removeSubscription($filter)
     {
-    	if (isset($this->_data['subscriptions'][$filter])) {
-    		unset($this->_data['subscriptions'][$filter]);
-    	}
+        if (isset($this->_data['subscriptions'][$filter])) {
+            unset($this->_data['subscriptions'][$filter]);
+        }
     }
 }

+ 12 - 12
library/Zend/Service/WindowsAzure/Diagnostics/DirectoryConfigurationSubscription.php

@@ -37,26 +37,26 @@ require_once 'Zend/Service/WindowsAzure/Diagnostics/ConfigurationObjectBaseAbstr
  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  *
- * @property	string	Path					Path
- * @property	string	Container				Container
- * @property	int		DirectoryQuotaInMB		Directory quota in MB
+ * @property    string    Path                    Path
+ * @property    string    Container                Container
+ * @property    int        DirectoryQuotaInMB        Directory quota in MB
  */
 class Zend_Service_WindowsAzure_Diagnostics_DirectoryConfigurationSubscription
-	extends Zend_Service_WindowsAzure_Diagnostics_ConfigurationObjectBaseAbstract
+    extends Zend_Service_WindowsAzure_Diagnostics_ConfigurationObjectBaseAbstract
 {
     /**
      * Constructor
      *
-	 * @param	string	$path					Path
-	 * @param	string	$container				Container
-	 * @param	int		$directoryQuotaInMB		Directory quota in MB
-	 */
+     * @param    string    $path                    Path
+     * @param    string    $container                Container
+     * @param    int        $directoryQuotaInMB        Directory quota in MB
+     */
     public function __construct($path, $container, $directoryQuotaInMB = 1024)
-    {	
+    {    
         $this->_data = array(
-            'path'      			=> $path,
-            'container' 			=> $container,
-        	'directoryquotainmb' 	=> $directoryQuotaInMB
+            'path'                  => $path,
+            'container'             => $container,
+            'directoryquotainmb'     => $directoryQuotaInMB
         );
     }
 }

+ 1 - 1
library/Zend/Service/WindowsAzure/Diagnostics/Exception.php

@@ -33,6 +33,6 @@ require_once 'Zend/Service/WindowsAzure/Exception.php';
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  */
 class Zend_Service_WindowsAzure_Diagnostics_Exception
-	extends Zend_Service_WindowsAzure_Exception
+    extends Zend_Service_WindowsAzure_Exception
 {
 }

+ 6 - 6
library/Zend/Service/WindowsAzure/Diagnostics/LogLevel.php

@@ -30,10 +30,10 @@
  */
 class Zend_Service_WindowsAzure_Diagnostics_LogLevel
 {
-	const UNDEFINED 	= 'Undefined';
-	const CRITICAL 		= 'Critical';
-	const ERROR 		= 'Error';
-	const WARNING 		= 'Warning';
-	const INFORMATION 	= 'Information';
-	const VERBOSE 		= 'Verbose';
+    const UNDEFINED     = 'Undefined';
+    const CRITICAL         = 'Critical';
+    const ERROR         = 'Error';
+    const WARNING         = 'Warning';
+    const INFORMATION     = 'Information';
+    const VERBOSE         = 'Verbose';
 }

+ 136 - 136
library/Zend/Service/WindowsAzure/Diagnostics/Manager.php

@@ -44,148 +44,148 @@ require_once 'Zend/Service/WindowsAzure/Diagnostics/ConfigurationInstance.php';
  */
 class Zend_Service_WindowsAzure_Diagnostics_Manager
 {
-	/**
-	 * Blob storage client
-	 *
-	 * @var Zend_Service_WindowsAzure_Storage_Blob
-	 */
-	protected $_blobStorageClient = null;
-	
-	/**
-	 * Control container name
-	 *
-	 * @var string
-	 */
-	protected $_controlContainer = '';
+    /**
+     * Blob storage client
+     *
+     * @var Zend_Service_WindowsAzure_Storage_Blob
+     */
+    protected $_blobStorageClient = null;
+    
+    /**
+     * Control container name
+     *
+     * @var string
+     */
+    protected $_controlContainer = '';
 
-	/**
-	 * Create a new instance of Zend_Service_WindowsAzure_Diagnostics_Manager
-	 *
-	 * @param Zend_Service_WindowsAzure_Storage_Blob $blobStorageClient Blob storage client
-	 * @param string $controlContainer Control container name
-	 */
-	public function __construct(Zend_Service_WindowsAzure_Storage_Blob $blobStorageClient = null, $controlContainer = 'wad-control-container')
-	{
-		$this->_blobStorageClient = $blobStorageClient;
-		$this->_controlContainer = $controlContainer;
+    /**
+     * Create a new instance of Zend_Service_WindowsAzure_Diagnostics_Manager
+     *
+     * @param Zend_Service_WindowsAzure_Storage_Blob $blobStorageClient Blob storage client
+     * @param string $controlContainer Control container name
+     */
+    public function __construct(Zend_Service_WindowsAzure_Storage_Blob $blobStorageClient = null, $controlContainer = 'wad-control-container')
+    {
+        $this->_blobStorageClient = $blobStorageClient;
+        $this->_controlContainer = $controlContainer;
 
-		$this->_ensureStorageInitialized();
-	}
+        $this->_ensureStorageInitialized();
+    }
 
-	/**
-	 * Ensure storage has been initialized
-	 */
-	protected function _ensureStorageInitialized()
-	{
-		if (!$this->_blobStorageClient->containerExists($this->_controlContainer)) {
-			$this->_blobStorageClient->createContainer($this->_controlContainer);
-		}
-	}
-	
-	/**
-	 * Get default configuration values
-	 *
-	 * @return Zend_Service_WindowsAzure_Diagnostics_ConfigurationInstance
-	 */
-	public function getDefaultConfiguration()
-	{
-		return new Zend_Service_WindowsAzure_Diagnostics_ConfigurationInstance();
-	}
-	
-	/**
-	 * Checks if a configuration for a specific role instance exists.
-	 *
-	 * @param string $roleInstance Role instance name, can be found in $_SERVER['RdRoleId'] when hosted on Windows Azure.
-	 * @return boolean
-	 * @throws Zend_Service_WindowsAzure_Diagnostics_Exception
-	 */
-	public function configurationForRoleInstanceExists($roleInstance = null)
-	{
-		if ($roleInstance === null) {
-			throw new Zend_Service_WindowsAzure_Diagnostics_Exception('Role instance should be specified. Try reading $_SERVER[\'RdRoleId\'] for this information if the application is hosted on Windows Azure Fabric or Development Fabric.');
-		}
+    /**
+     * Ensure storage has been initialized
+     */
+    protected function _ensureStorageInitialized()
+    {
+        if (!$this->_blobStorageClient->containerExists($this->_controlContainer)) {
+            $this->_blobStorageClient->createContainer($this->_controlContainer);
+        }
+    }
+    
+    /**
+     * Get default configuration values
+     *
+     * @return Zend_Service_WindowsAzure_Diagnostics_ConfigurationInstance
+     */
+    public function getDefaultConfiguration()
+    {
+        return new Zend_Service_WindowsAzure_Diagnostics_ConfigurationInstance();
+    }
+    
+    /**
+     * Checks if a configuration for a specific role instance exists.
+     *
+     * @param string $roleInstance Role instance name, can be found in $_SERVER['RdRoleId'] when hosted on Windows Azure.
+     * @return boolean
+     * @throws Zend_Service_WindowsAzure_Diagnostics_Exception
+     */
+    public function configurationForRoleInstanceExists($roleInstance = null)
+    {
+        if ($roleInstance === null) {
+            throw new Zend_Service_WindowsAzure_Diagnostics_Exception('Role instance should be specified. Try reading $_SERVER[\'RdRoleId\'] for this information if the application is hosted on Windows Azure Fabric or Development Fabric.');
+        }
 
-		return $this->_blobStorageClient->blobExists($this->_controlContainer, $roleInstance);
-	}
-	
-	/**
-	 * Checks if a configuration for current role instance exists. Only works on Development Fabric or Windows Azure Fabric.
-	 *
-	 * @return boolean
-	 * @throws Zend_Service_WindowsAzure_Diagnostics_Exception
-	 */
-	public function configurationForCurrentRoleInstanceExists()
-	{
-		if (!isset($_SERVER['RdRoleId'])) {
-			throw new Zend_Service_WindowsAzure_Diagnostics_Exception('Server variable \'RdRoleId\' is unknown. Please verify the application is running in Development Fabric or Windows Azure Fabric.');
-		}
+        return $this->_blobStorageClient->blobExists($this->_controlContainer, $roleInstance);
+    }
+    
+    /**
+     * Checks if a configuration for current role instance exists. Only works on Development Fabric or Windows Azure Fabric.
+     *
+     * @return boolean
+     * @throws Zend_Service_WindowsAzure_Diagnostics_Exception
+     */
+    public function configurationForCurrentRoleInstanceExists()
+    {
+        if (!isset($_SERVER['RdRoleId'])) {
+            throw new Zend_Service_WindowsAzure_Diagnostics_Exception('Server variable \'RdRoleId\' is unknown. Please verify the application is running in Development Fabric or Windows Azure Fabric.');
+        }
 
-		return $this->_blobStorageClient->blobExists($this->_controlContainer, $_SERVER['RdRoleId']);
-	}
-	
-	/**
-	 * Get configuration for current role instance. Only works on Development Fabric or Windows Azure Fabric.
-	 *
-	 * @return Zend_Service_WindowsAzure_Diagnostics_ConfigurationInstance
-	 * @throws Zend_Service_WindowsAzure_Diagnostics_Exception
-	 */
-	public function getConfigurationForCurrentRoleInstance()
-	{
-		if (!isset($_SERVER['RdRoleId'])) {
-			throw new Zend_Service_WindowsAzure_Diagnostics_Exception('Server variable \'RdRoleId\' is unknown. Please verify the application is running in Development Fabric or Windows Azure Fabric.');
-		}
-		return $this->getConfigurationForRoleInstance($_SERVER['RdRoleId']);
-	}
-	
-	/**
-	 * Set configuration for current role instance. Only works on Development Fabric or Windows Azure Fabric.
-	 *
-	 * @param Zend_Service_WindowsAzure_Diagnostics_ConfigurationInstance $configuration Configuration to apply
-	 * @throws Zend_Service_WindowsAzure_Diagnostics_Exception
-	 */
-	public function setConfigurationForCurrentRoleInstance(Zend_Service_WindowsAzure_Diagnostics_ConfigurationInstance $configuration)
-	{
-		if (!isset($_SERVER['RdRoleId'])) {
-			throw new Zend_Service_WindowsAzure_Diagnostics_Exception('Server variable \'RdRoleId\' is unknown. Please verify the application is running in Development Fabric or Windows Azure Fabric.');
-		}
-		$this->setConfigurationForRoleInstance($_SERVER['RdRoleId'], $configuration);
-	}
-	
-	/**
-	 * Get configuration for a specific role instance
-	 *
-	 * @param string $roleInstance Role instance name, can be found in $_SERVER['RdRoleId'] when hosted on Windows Azure.
-	 * @return Zend_Service_WindowsAzure_Diagnostics_ConfigurationInstance
-	 * @throws Zend_Service_WindowsAzure_Diagnostics_Exception
-	 */
-	public function getConfigurationForRoleInstance($roleInstance = null)
-	{
-		if ($roleInstance === null) {
-			throw new Zend_Service_WindowsAzure_Diagnostics_Exception('Role instance should be specified. Try reading $_SERVER[\'RdRoleId\'] for this information if the application is hosted on Windows Azure Fabric or Development Fabric.');
-		}
+        return $this->_blobStorageClient->blobExists($this->_controlContainer, $_SERVER['RdRoleId']);
+    }
+    
+    /**
+     * Get configuration for current role instance. Only works on Development Fabric or Windows Azure Fabric.
+     *
+     * @return Zend_Service_WindowsAzure_Diagnostics_ConfigurationInstance
+     * @throws Zend_Service_WindowsAzure_Diagnostics_Exception
+     */
+    public function getConfigurationForCurrentRoleInstance()
+    {
+        if (!isset($_SERVER['RdRoleId'])) {
+            throw new Zend_Service_WindowsAzure_Diagnostics_Exception('Server variable \'RdRoleId\' is unknown. Please verify the application is running in Development Fabric or Windows Azure Fabric.');
+        }
+        return $this->getConfigurationForRoleInstance($_SERVER['RdRoleId']);
+    }
+    
+    /**
+     * Set configuration for current role instance. Only works on Development Fabric or Windows Azure Fabric.
+     *
+     * @param Zend_Service_WindowsAzure_Diagnostics_ConfigurationInstance $configuration Configuration to apply
+     * @throws Zend_Service_WindowsAzure_Diagnostics_Exception
+     */
+    public function setConfigurationForCurrentRoleInstance(Zend_Service_WindowsAzure_Diagnostics_ConfigurationInstance $configuration)
+    {
+        if (!isset($_SERVER['RdRoleId'])) {
+            throw new Zend_Service_WindowsAzure_Diagnostics_Exception('Server variable \'RdRoleId\' is unknown. Please verify the application is running in Development Fabric or Windows Azure Fabric.');
+        }
+        $this->setConfigurationForRoleInstance($_SERVER['RdRoleId'], $configuration);
+    }
+    
+    /**
+     * Get configuration for a specific role instance
+     *
+     * @param string $roleInstance Role instance name, can be found in $_SERVER['RdRoleId'] when hosted on Windows Azure.
+     * @return Zend_Service_WindowsAzure_Diagnostics_ConfigurationInstance
+     * @throws Zend_Service_WindowsAzure_Diagnostics_Exception
+     */
+    public function getConfigurationForRoleInstance($roleInstance = null)
+    {
+        if ($roleInstance === null) {
+            throw new Zend_Service_WindowsAzure_Diagnostics_Exception('Role instance should be specified. Try reading $_SERVER[\'RdRoleId\'] for this information if the application is hosted on Windows Azure Fabric or Development Fabric.');
+        }
 
-		if ($this->_blobStorageClient->blobExists($this->_controlContainer, $roleInstance)) {
-			$configurationInstance = new Zend_Service_WindowsAzure_Diagnostics_ConfigurationInstance();
-			$configurationInstance->loadXml( $this->_blobStorageClient->getBlobData($this->_controlContainer, $roleInstance) );
-			return $configurationInstance;
-		}
+        if ($this->_blobStorageClient->blobExists($this->_controlContainer, $roleInstance)) {
+            $configurationInstance = new Zend_Service_WindowsAzure_Diagnostics_ConfigurationInstance();
+            $configurationInstance->loadXml( $this->_blobStorageClient->getBlobData($this->_controlContainer, $roleInstance) );
+            return $configurationInstance;
+        }
 
-		return new Zend_Service_WindowsAzure_Diagnostics_ConfigurationInstance();
-	}
-	
-	/**
-	 * Set configuration for a specific role instance
-	 *
-	 * @param string $roleInstance Role instance name, can be found in $_SERVER['RdRoleId'] when hosted on Windows Azure.
-	 * @param Zend_Service_WindowsAzure_Diagnostics_ConfigurationInstance $configuration Configuration to apply
-	 * @throws Zend_Service_WindowsAzure_Diagnostics_Exception
-	 */
-	public function setConfigurationForRoleInstance($roleInstance = null, Zend_Service_WindowsAzure_Diagnostics_ConfigurationInstance $configuration)
-	{
-		if ($roleInstance === null) {
-			throw new Zend_Service_WindowsAzure_Diagnostics_Exception('Role instance should be specified. Try reading $_SERVER[\'RdRoleId\'] for this information if the application is hosted on Windows Azure Fabric or Development Fabric.');
-		}
+        return new Zend_Service_WindowsAzure_Diagnostics_ConfigurationInstance();
+    }
+    
+    /**
+     * Set configuration for a specific role instance
+     *
+     * @param string $roleInstance Role instance name, can be found in $_SERVER['RdRoleId'] when hosted on Windows Azure.
+     * @param Zend_Service_WindowsAzure_Diagnostics_ConfigurationInstance $configuration Configuration to apply
+     * @throws Zend_Service_WindowsAzure_Diagnostics_Exception
+     */
+    public function setConfigurationForRoleInstance($roleInstance = null, Zend_Service_WindowsAzure_Diagnostics_ConfigurationInstance $configuration)
+    {
+        if ($roleInstance === null) {
+            throw new Zend_Service_WindowsAzure_Diagnostics_Exception('Role instance should be specified. Try reading $_SERVER[\'RdRoleId\'] for this information if the application is hosted on Windows Azure Fabric or Development Fabric.');
+        }
 
-		$this->_blobStorageClient->putBlobData($this->_controlContainer, $roleInstance, $configuration->toXml(), array(), null, array('Content-Type' => 'text/xml'));
-	}
+        $this->_blobStorageClient->putBlobData($this->_controlContainer, $roleInstance, $configuration->toXml(), array(), null, array('Content-Type' => 'text/xml'));
+    }
 }

+ 8 - 8
library/Zend/Service/WindowsAzure/Diagnostics/PerformanceCounterSubscription.php

@@ -37,23 +37,23 @@ require_once 'Zend/Service/WindowsAzure/Diagnostics/ConfigurationObjectBaseAbstr
  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  *
- * @property	string	CounterSpecifier					Counter specifier
- * @property	int		SampleRateInSeconds					Sample rate in seconds
+ * @property    string    CounterSpecifier                    Counter specifier
+ * @property    int        SampleRateInSeconds                    Sample rate in seconds
  */
 class Zend_Service_WindowsAzure_Diagnostics_PerformanceCounterSubscription
-	extends Zend_Service_WindowsAzure_Diagnostics_ConfigurationObjectBaseAbstract
+    extends Zend_Service_WindowsAzure_Diagnostics_ConfigurationObjectBaseAbstract
 {
     /**
      * Constructor
      *
- 	 * @param	string	$counterSpecifier					Counter specifier
- 	 * @param	int		$sampleRateInSeconds				Sample rate in seconds
-	 */
+      * @param    string    $counterSpecifier                    Counter specifier
+      * @param    int        $sampleRateInSeconds                Sample rate in seconds
+     */
     public function __construct($counterSpecifier, $sampleRateInSeconds = 1)
-    {	
+    {    
         $this->_data = array(
             'counterspecifier'      => $counterSpecifier,
-            'samplerateinseconds' 	=> $sampleRateInSeconds
+            'samplerateinseconds'     => $sampleRateInSeconds
         );
     }
 }

+ 25 - 25
library/Zend/Service/WindowsAzure/SessionHandler.php

@@ -57,7 +57,7 @@ class Zend_Service_WindowsAzure_SessionHandler
      * @var string
      */
     protected $_sessionTablePartition;
-	
+    
     /**
      * Creates a new Zend_Service_WindowsAzure_SessionHandler instance
      *
@@ -66,20 +66,20 @@ class Zend_Service_WindowsAzure_SessionHandler
      * @param string $sessionTablePartition Session table partition
      */
     public function __construct(Zend_Service_WindowsAzure_Storage_Table $tableStorage, $sessionTable = 'phpsessions', $sessionTablePartition = 'sessions')
-	{
-	    // Set properties
-		$this->_tableStorage = $tableStorage;
-		$this->_sessionTable = $sessionTable;
-		$this->_sessionTablePartition = $sessionTablePartition;
-	}
-	
-	/**
-	 * Registers the current session handler as PHP's session handler
-	 *
-	 * @return boolean
-	 */
-	public function register()
-	{
+    {
+        // Set properties
+        $this->_tableStorage = $tableStorage;
+        $this->_sessionTable = $sessionTable;
+        $this->_sessionTablePartition = $sessionTablePartition;
+    }
+    
+    /**
+     * Registers the current session handler as PHP's session handler
+     *
+     * @return boolean
+     */
+    public function register()
+    {
         return session_set_save_handler(array($this, 'open'),
                                         array($this, 'close'),
                                         array($this, 'read'),
@@ -87,8 +87,8 @@ class Zend_Service_WindowsAzure_SessionHandler
                                         array($this, 'destroy'),
                                         array($this, 'gc')
         );
-	}
-	
+    }
+    
     /**
      * Open the session store
      *
@@ -96,14 +96,14 @@ class Zend_Service_WindowsAzure_SessionHandler
      */
     public function open()
     {
-    	// Make sure table exists
-    	$tableExists = $this->_tableStorage->tableExists($this->_sessionTable);
-    	if (!$tableExists) {
-		    $this->_tableStorage->createTable($this->_sessionTable);
-		}
-		
-		// Ok!
-		return true;
+        // Make sure table exists
+        $tableExists = $this->_tableStorage->tableExists($this->_sessionTable);
+        if (!$tableExists) {
+            $this->_tableStorage->createTable($this->_sessionTable);
+        }
+        
+        // Ok!
+        return true;
     }
 
     /**

+ 461 - 461
library/Zend/Service/WindowsAzure/Storage.php

@@ -59,185 +59,185 @@ require_once 'Zend/Http/Response.php';
  */
 class Zend_Service_WindowsAzure_Storage
 {
-	/**
-	 * Development storage URLS
-	 */
-	const URL_DEV_BLOB      = "127.0.0.1:10000";
-	const URL_DEV_QUEUE     = "127.0.0.1:10001";
-	const URL_DEV_TABLE     = "127.0.0.1:10002";
-	
-	/**
-	 * Live storage URLS
-	 */
-	const URL_CLOUD_BLOB    = "blob.core.windows.net";
-	const URL_CLOUD_QUEUE   = "queue.core.windows.net";
-	const URL_CLOUD_TABLE   = "table.core.windows.net";
-	
-	/**
-	 * Resource types
-	 */
-	const RESOURCE_UNKNOWN     = "unknown";
-	const RESOURCE_CONTAINER   = "c";
-	const RESOURCE_BLOB        = "b";
-	const RESOURCE_TABLE       = "t";
-	const RESOURCE_ENTITY      = "e";
-	const RESOURCE_QUEUE       = "q";
-	
-	/**
-	 * HTTP header prefixes
-	 */
-	const PREFIX_PROPERTIES      = "x-ms-prop-";
-	const PREFIX_METADATA        = "x-ms-meta-";
-	const PREFIX_STORAGE_HEADER  = "x-ms-";
-	
-	/**
-	 * Current API version
-	 *
-	 * @var string
-	 */
-	protected $_apiVersion = '2009-09-19';
-	
-	/**
-	 * Storage host name
-	 *
-	 * @var string
-	 */
-	protected $_host = '';
-	
-	/**
-	 * Account name for Windows Azure
-	 *
-	 * @var string
-	 */
-	protected $_accountName = '';
-	
-	/**
-	 * Account key for Windows Azure
-	 *
-	 * @var string
-	 */
-	protected $_accountKey = '';
-	
-	/**
-	 * Use path-style URI's
-	 *
-	 * @var boolean
-	 */
-	protected $_usePathStyleUri = false;
-	
-	/**
-	 * Zend_Service_WindowsAzure_Credentials_CredentialsAbstract instance
-	 *
-	 * @var Zend_Service_WindowsAzure_Credentials_CredentialsAbstract
-	 */
-	protected $_credentials = null;
-	
-	/**
-	 * Zend_Service_WindowsAzure_RetryPolicy_RetryPolicyAbstract instance
-	 *
-	 * @var Zend_Service_WindowsAzure_RetryPolicy_RetryPolicyAbstract
-	 */
-	protected $_retryPolicy = null;
-	
-	/**
-	 * Zend_Http_Client channel used for communication with REST services
-	 *
-	 * @var Zend_Http_Client
-	 */
-	protected $_httpClientChannel = null;
-	
-	/**
-	 * Use proxy?
-	 *
-	 * @var boolean
-	 */
-	protected $_useProxy = false;
-	
-	/**
-	 * Proxy url
-	 *
-	 * @var string
-	 */
-	protected $_proxyUrl = '';
-	
-	/**
-	 * Proxy port
-	 *
-	 * @var int
-	 */
-	protected $_proxyPort = 80;
-	
-	/**
-	 * Proxy credentials
-	 *
-	 * @var string
-	 */
-	protected $_proxyCredentials = '';
-	
-	/**
-	 * Creates a new Zend_Service_WindowsAzure_Storage instance
-	 *
-	 * @param string $host Storage host name
-	 * @param string $accountName Account name for Windows Azure
-	 * @param string $accountKey Account key for Windows Azure
-	 * @param boolean $usePathStyleUri Use path-style URI's
-	 * @param Zend_Service_WindowsAzure_RetryPolicy_RetryPolicyAbstract $retryPolicy Retry policy to use when making requests
-	 */
-	public function __construct(
-		$host = self::URL_DEV_BLOB,
-		$accountName = Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::DEVSTORE_ACCOUNT,
-		$accountKey = Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::DEVSTORE_KEY,
-		$usePathStyleUri = false,
-		Zend_Service_WindowsAzure_RetryPolicy_RetryPolicyAbstract $retryPolicy = null
-	) {
-		$this->_host = $host;
-		$this->_accountName = $accountName;
-		$this->_accountKey = $accountKey;
-		$this->_usePathStyleUri = $usePathStyleUri;
-		
-		// Using local storage?
-		if (!$this->_usePathStyleUri
-			&& ($this->_host == self::URL_DEV_BLOB
-				|| $this->_host == self::URL_DEV_QUEUE
-				|| $this->_host == self::URL_DEV_TABLE)
-		) {
-			// Local storage
-			$this->_usePathStyleUri = true;
-		}
-		
-		if ($this->_credentials === null) {
-		    $this->_credentials = new Zend_Service_WindowsAzure_Credentials_SharedKey(
-		    	$this->_accountName, $this->_accountKey, $this->_usePathStyleUri);
-		}
-		
-		$this->_retryPolicy = $retryPolicy;
-		if ($this->_retryPolicy === null) {
-		    $this->_retryPolicy = Zend_Service_WindowsAzure_RetryPolicy_RetryPolicyAbstract::noRetry();
-		}
-		
-		// Setup default Zend_Http_Client channel
-		$options = array(
-			'adapter' => 'Zend_Http_Client_Adapter_Proxy'
-		);
-		if (function_exists('curl_init')) {
-			// Set cURL options if cURL is used afterwards
-			$options['curloptions'] = array(
-					CURLOPT_FOLLOWLOCATION => true,
-					CURLOPT_TIMEOUT => 120,
-			);
-		}
-		$this->_httpClientChannel = new Zend_Http_Client(null, $options);
-	}
-	
-	/**
-	 * Set the HTTP client channel to use
-	 *
-	 * @param Zend_Http_Client_Adapter_Interface|string $adapterInstance Adapter instance or adapter class name.
-	 */
-	public function setHttpClientChannel($adapterInstance = 'Zend_Http_Client_Adapter_Proxy')
-	{
-		$this->_httpClientChannel->setAdapter($adapterInstance);
-	}
+    /**
+     * Development storage URLS
+     */
+    const URL_DEV_BLOB      = "127.0.0.1:10000";
+    const URL_DEV_QUEUE     = "127.0.0.1:10001";
+    const URL_DEV_TABLE     = "127.0.0.1:10002";
+    
+    /**
+     * Live storage URLS
+     */
+    const URL_CLOUD_BLOB    = "blob.core.windows.net";
+    const URL_CLOUD_QUEUE   = "queue.core.windows.net";
+    const URL_CLOUD_TABLE   = "table.core.windows.net";
+    
+    /**
+     * Resource types
+     */
+    const RESOURCE_UNKNOWN     = "unknown";
+    const RESOURCE_CONTAINER   = "c";
+    const RESOURCE_BLOB        = "b";
+    const RESOURCE_TABLE       = "t";
+    const RESOURCE_ENTITY      = "e";
+    const RESOURCE_QUEUE       = "q";
+    
+    /**
+     * HTTP header prefixes
+     */
+    const PREFIX_PROPERTIES      = "x-ms-prop-";
+    const PREFIX_METADATA        = "x-ms-meta-";
+    const PREFIX_STORAGE_HEADER  = "x-ms-";
+    
+    /**
+     * Current API version
+     *
+     * @var string
+     */
+    protected $_apiVersion = '2009-09-19';
+    
+    /**
+     * Storage host name
+     *
+     * @var string
+     */
+    protected $_host = '';
+    
+    /**
+     * Account name for Windows Azure
+     *
+     * @var string
+     */
+    protected $_accountName = '';
+    
+    /**
+     * Account key for Windows Azure
+     *
+     * @var string
+     */
+    protected $_accountKey = '';
+    
+    /**
+     * Use path-style URI's
+     *
+     * @var boolean
+     */
+    protected $_usePathStyleUri = false;
+    
+    /**
+     * Zend_Service_WindowsAzure_Credentials_CredentialsAbstract instance
+     *
+     * @var Zend_Service_WindowsAzure_Credentials_CredentialsAbstract
+     */
+    protected $_credentials = null;
+    
+    /**
+     * Zend_Service_WindowsAzure_RetryPolicy_RetryPolicyAbstract instance
+     *
+     * @var Zend_Service_WindowsAzure_RetryPolicy_RetryPolicyAbstract
+     */
+    protected $_retryPolicy = null;
+    
+    /**
+     * Zend_Http_Client channel used for communication with REST services
+     *
+     * @var Zend_Http_Client
+     */
+    protected $_httpClientChannel = null;
+    
+    /**
+     * Use proxy?
+     *
+     * @var boolean
+     */
+    protected $_useProxy = false;
+    
+    /**
+     * Proxy url
+     *
+     * @var string
+     */
+    protected $_proxyUrl = '';
+    
+    /**
+     * Proxy port
+     *
+     * @var int
+     */
+    protected $_proxyPort = 80;
+    
+    /**
+     * Proxy credentials
+     *
+     * @var string
+     */
+    protected $_proxyCredentials = '';
+    
+    /**
+     * Creates a new Zend_Service_WindowsAzure_Storage instance
+     *
+     * @param string $host Storage host name
+     * @param string $accountName Account name for Windows Azure
+     * @param string $accountKey Account key for Windows Azure
+     * @param boolean $usePathStyleUri Use path-style URI's
+     * @param Zend_Service_WindowsAzure_RetryPolicy_RetryPolicyAbstract $retryPolicy Retry policy to use when making requests
+     */
+    public function __construct(
+        $host = self::URL_DEV_BLOB,
+        $accountName = Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::DEVSTORE_ACCOUNT,
+        $accountKey = Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::DEVSTORE_KEY,
+        $usePathStyleUri = false,
+        Zend_Service_WindowsAzure_RetryPolicy_RetryPolicyAbstract $retryPolicy = null
+    ) {
+        $this->_host = $host;
+        $this->_accountName = $accountName;
+        $this->_accountKey = $accountKey;
+        $this->_usePathStyleUri = $usePathStyleUri;
+        
+        // Using local storage?
+        if (!$this->_usePathStyleUri
+            && ($this->_host == self::URL_DEV_BLOB
+                || $this->_host == self::URL_DEV_QUEUE
+                || $this->_host == self::URL_DEV_TABLE)
+        ) {
+            // Local storage
+            $this->_usePathStyleUri = true;
+        }
+        
+        if ($this->_credentials === null) {
+            $this->_credentials = new Zend_Service_WindowsAzure_Credentials_SharedKey(
+                $this->_accountName, $this->_accountKey, $this->_usePathStyleUri);
+        }
+        
+        $this->_retryPolicy = $retryPolicy;
+        if ($this->_retryPolicy === null) {
+            $this->_retryPolicy = Zend_Service_WindowsAzure_RetryPolicy_RetryPolicyAbstract::noRetry();
+        }
+        
+        // Setup default Zend_Http_Client channel
+        $options = array(
+            'adapter' => 'Zend_Http_Client_Adapter_Proxy'
+        );
+        if (function_exists('curl_init')) {
+            // Set cURL options if cURL is used afterwards
+            $options['curloptions'] = array(
+                    CURLOPT_FOLLOWLOCATION => true,
+                    CURLOPT_TIMEOUT => 120,
+            );
+        }
+        $this->_httpClientChannel = new Zend_Http_Client(null, $options);
+    }
+    
+    /**
+     * Set the HTTP client channel to use
+     *
+     * @param Zend_Http_Client_Adapter_Interface|string $adapterInstance Adapter instance or adapter class name.
+     */
+    public function setHttpClientChannel($adapterInstance = 'Zend_Http_Client_Adapter_Proxy')
+    {
+        $this->_httpClientChannel->setAdapter($adapterInstance);
+    }
 
     /**
      * Retrieve HTTP client channel
@@ -248,183 +248,183 @@ class Zend_Service_WindowsAzure_Storage
     {
         return $this->_httpClientChannel;
     }
-	
-	/**
-	 * Set retry policy to use when making requests
-	 *
-	 * @param Zend_Service_WindowsAzure_RetryPolicy_RetryPolicyAbstract $retryPolicy Retry policy to use when making requests
-	 */
-	public function setRetryPolicy(Zend_Service_WindowsAzure_RetryPolicy_RetryPolicyAbstract $retryPolicy = null)
-	{
-		$this->_retryPolicy = $retryPolicy;
-		if ($this->_retryPolicy === null) {
-		    $this->_retryPolicy = Zend_Service_WindowsAzure_RetryPolicy_RetryPolicyAbstract::noRetry();
-		}
-	}
-	
-	/**
-	 * Set proxy
-	 *
-	 * @param boolean $useProxy         Use proxy?
-	 * @param string  $proxyUrl         Proxy URL
-	 * @param int     $proxyPort        Proxy port
-	 * @param string  $proxyCredentials Proxy credentials
-	 */
-	public function setProxy($useProxy = false, $proxyUrl = '', $proxyPort = 80, $proxyCredentials = '')
-	{
-	    $this->_useProxy         = $useProxy;
-	    $this->_proxyUrl         = $proxyUrl;
-	    $this->_proxyPort        = $proxyPort;
-	    $this->_proxyCredentials = $proxyCredentials;
-	
-	    if ($this->_useProxy) {
-	    	$credentials = explode(':', $this->_proxyCredentials);
-	    	
-	    	$this->_httpClientChannel->setConfig(array(
-				'proxy_host' => $this->_proxyUrl,
-	    		'proxy_port' => $this->_proxyPort,
-	    		'proxy_user' => $credentials[0],
-	    		'proxy_pass' => $credentials[1],
-	    	));
-	    } else {
-			$this->_httpClientChannel->setConfig(array(
-				'proxy_host' => '',
-	    		'proxy_port' => 8080,
-	    		'proxy_user' => '',
-	    		'proxy_pass' => '',
-	    	));
-	    }
-	}
-	
-	/**
-	 * Returns the Windows Azure account name
-	 *
-	 * @return string
-	 */
-	public function getAccountName()
-	{
-		return $this->_accountName;
-	}
-	
-	/**
-	 * Get base URL for creating requests
-	 *
-	 * @return string
-	 */
-	public function getBaseUrl()
-	{
-		if ($this->_usePathStyleUri) {
-			return 'http://' . $this->_host . '/' . $this->_accountName;
-		} else {
-			return 'http://' . $this->_accountName . '.' . $this->_host;
-		}
-	}
-	
-	/**
-	 * Set Zend_Service_WindowsAzure_Credentials_CredentialsAbstract instance
-	 *
-	 * @param Zend_Service_WindowsAzure_Credentials_CredentialsAbstract $credentials Zend_Service_WindowsAzure_Credentials_CredentialsAbstract instance to use for request signing.
-	 */
-	public function setCredentials(Zend_Service_WindowsAzure_Credentials_CredentialsAbstract $credentials)
-	{
-	    $this->_credentials = $credentials;
-	    $this->_credentials->setAccountName($this->_accountName);
-	    $this->_credentials->setAccountkey($this->_accountKey);
-	    $this->_credentials->setUsePathStyleUri($this->_usePathStyleUri);
-	}
-	
-	/**
-	 * Get Zend_Service_WindowsAzure_Credentials_CredentialsAbstract instance
-	 *
-	 * @return Zend_Service_WindowsAzure_Credentials_CredentialsAbstract
-	 */
-	public function getCredentials()
-	{
-	    return $this->_credentials;
-	}
-	
-	/**
-	 * Perform request using Zend_Http_Client channel
-	 *
-	 * @param string $path Path
-	 * @param string $queryString Query string
-	 * @param string $httpVerb HTTP verb the request will use
-	 * @param array $headers x-ms headers to add
-	 * @param boolean $forTableStorage Is the request for table storage?
-	 * @param mixed $rawData Optional RAW HTTP data to be sent over the wire
-	 * @param string $resourceType Resource type
-	 * @param string $requiredPermission Required permission
-	 * @return Zend_Http_Response
-	 */
-	protected function _performRequest(
-		$path = '/',
-		$queryString = '',
-		$httpVerb = Zend_Http_Client::GET,
-		$headers = array(),
-		$forTableStorage = false,
-		$rawData = null,
-		$resourceType = Zend_Service_WindowsAzure_Storage::RESOURCE_UNKNOWN,
-		$requiredPermission = Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PERMISSION_READ
-	) {
-	    // Clean path
-		if (strpos($path, '/') !== 0) {
-			$path = '/' . $path;
-		}
-			
-		// Clean headers
-		if ($headers === null) {
-		    $headers = array();
-		}
-		
-		// Ensure cUrl will also work correctly:
-		//  - disable Content-Type if required
-		//  - disable Expect: 100 Continue
-		if (!isset($headers["Content-Type"])) {
-			$headers["Content-Type"] = '';
-		}
-		$headers["Expect"]= '';
+    
+    /**
+     * Set retry policy to use when making requests
+     *
+     * @param Zend_Service_WindowsAzure_RetryPolicy_RetryPolicyAbstract $retryPolicy Retry policy to use when making requests
+     */
+    public function setRetryPolicy(Zend_Service_WindowsAzure_RetryPolicy_RetryPolicyAbstract $retryPolicy = null)
+    {
+        $this->_retryPolicy = $retryPolicy;
+        if ($this->_retryPolicy === null) {
+            $this->_retryPolicy = Zend_Service_WindowsAzure_RetryPolicy_RetryPolicyAbstract::noRetry();
+        }
+    }
+    
+    /**
+     * Set proxy
+     *
+     * @param boolean $useProxy         Use proxy?
+     * @param string  $proxyUrl         Proxy URL
+     * @param int     $proxyPort        Proxy port
+     * @param string  $proxyCredentials Proxy credentials
+     */
+    public function setProxy($useProxy = false, $proxyUrl = '', $proxyPort = 80, $proxyCredentials = '')
+    {
+        $this->_useProxy         = $useProxy;
+        $this->_proxyUrl         = $proxyUrl;
+        $this->_proxyPort        = $proxyPort;
+        $this->_proxyCredentials = $proxyCredentials;
+    
+        if ($this->_useProxy) {
+            $credentials = explode(':', $this->_proxyCredentials);
+            
+            $this->_httpClientChannel->setConfig(array(
+                'proxy_host' => $this->_proxyUrl,
+                'proxy_port' => $this->_proxyPort,
+                'proxy_user' => $credentials[0],
+                'proxy_pass' => $credentials[1],
+            ));
+        } else {
+            $this->_httpClientChannel->setConfig(array(
+                'proxy_host' => '',
+                'proxy_port' => 8080,
+                'proxy_user' => '',
+                'proxy_pass' => '',
+            ));
+        }
+    }
+    
+    /**
+     * Returns the Windows Azure account name
+     *
+     * @return string
+     */
+    public function getAccountName()
+    {
+        return $this->_accountName;
+    }
+    
+    /**
+     * Get base URL for creating requests
+     *
+     * @return string
+     */
+    public function getBaseUrl()
+    {
+        if ($this->_usePathStyleUri) {
+            return 'http://' . $this->_host . '/' . $this->_accountName;
+        } else {
+            return 'http://' . $this->_accountName . '.' . $this->_host;
+        }
+    }
+    
+    /**
+     * Set Zend_Service_WindowsAzure_Credentials_CredentialsAbstract instance
+     *
+     * @param Zend_Service_WindowsAzure_Credentials_CredentialsAbstract $credentials Zend_Service_WindowsAzure_Credentials_CredentialsAbstract instance to use for request signing.
+     */
+    public function setCredentials(Zend_Service_WindowsAzure_Credentials_CredentialsAbstract $credentials)
+    {
+        $this->_credentials = $credentials;
+        $this->_credentials->setAccountName($this->_accountName);
+        $this->_credentials->setAccountkey($this->_accountKey);
+        $this->_credentials->setUsePathStyleUri($this->_usePathStyleUri);
+    }
+    
+    /**
+     * Get Zend_Service_WindowsAzure_Credentials_CredentialsAbstract instance
+     *
+     * @return Zend_Service_WindowsAzure_Credentials_CredentialsAbstract
+     */
+    public function getCredentials()
+    {
+        return $this->_credentials;
+    }
+    
+    /**
+     * Perform request using Zend_Http_Client channel
+     *
+     * @param string $path Path
+     * @param string $queryString Query string
+     * @param string $httpVerb HTTP verb the request will use
+     * @param array $headers x-ms headers to add
+     * @param boolean $forTableStorage Is the request for table storage?
+     * @param mixed $rawData Optional RAW HTTP data to be sent over the wire
+     * @param string $resourceType Resource type
+     * @param string $requiredPermission Required permission
+     * @return Zend_Http_Response
+     */
+    protected function _performRequest(
+        $path = '/',
+        $queryString = '',
+        $httpVerb = Zend_Http_Client::GET,
+        $headers = array(),
+        $forTableStorage = false,
+        $rawData = null,
+        $resourceType = Zend_Service_WindowsAzure_Storage::RESOURCE_UNKNOWN,
+        $requiredPermission = Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PERMISSION_READ
+    ) {
+        // Clean path
+        if (strpos($path, '/') !== 0) {
+            $path = '/' . $path;
+        }
+            
+        // Clean headers
+        if ($headers === null) {
+            $headers = array();
+        }
+        
+        // Ensure cUrl will also work correctly:
+        //  - disable Content-Type if required
+        //  - disable Expect: 100 Continue
+        if (!isset($headers["Content-Type"])) {
+            $headers["Content-Type"] = '';
+        }
+        $headers["Expect"]= '';
 
-		// Add version header
-		$headers['x-ms-version'] = $this->_apiVersion;
-		
-		// URL encoding
-		$path           = self::urlencode($path);
-		$queryString    = self::urlencode($queryString);
+        // Add version header
+        $headers['x-ms-version'] = $this->_apiVersion;
+        
+        // URL encoding
+        $path           = self::urlencode($path);
+        $queryString    = self::urlencode($queryString);
 
-		// Generate URL and sign request
-		$requestUrl     = $this->_credentials
-						  ->signRequestUrl($this->getBaseUrl() . $path . $queryString, $resourceType, $requiredPermission);
-		$requestHeaders = $this->_credentials
-						  ->signRequestHeaders($httpVerb, $path, $queryString, $headers, $forTableStorage, $resourceType, $requiredPermission, $rawData);
+        // Generate URL and sign request
+        $requestUrl     = $this->_credentials
+                          ->signRequestUrl($this->getBaseUrl() . $path . $queryString, $resourceType, $requiredPermission);
+        $requestHeaders = $this->_credentials
+                          ->signRequestHeaders($httpVerb, $path, $queryString, $headers, $forTableStorage, $resourceType, $requiredPermission, $rawData);
 
-		// Prepare request
-		$this->_httpClientChannel->resetParameters(true);
-		$this->_httpClientChannel->setUri($requestUrl);
-		$this->_httpClientChannel->setHeaders($requestHeaders);
-		$this->_httpClientChannel->setRawData($rawData);
-				
-		// Execute request
-		$response = $this->_retryPolicy->execute(
-		    array($this->_httpClientChannel, 'request'),
-		    array($httpVerb)
-		);
-		
-		return $response;
-	}
-	
-	/**
-	 * Parse result from Zend_Http_Response
-	 *
-	 * @param Zend_Http_Response $response Response from HTTP call
-	 * @return object
-	 * @throws Zend_Service_WindowsAzure_Exception
-	 */
-	protected function _parseResponse(Zend_Http_Response $response = null)
-	{
-		if ($response === null) {
-			throw new Zend_Service_WindowsAzure_Exception('Response should not be null.');
-		}
-		
+        // Prepare request
+        $this->_httpClientChannel->resetParameters(true);
+        $this->_httpClientChannel->setUri($requestUrl);
+        $this->_httpClientChannel->setHeaders($requestHeaders);
+        $this->_httpClientChannel->setRawData($rawData);
+                
+        // Execute request
+        $response = $this->_retryPolicy->execute(
+            array($this->_httpClientChannel, 'request'),
+            array($httpVerb)
+        );
+        
+        return $response;
+    }
+    
+    /**
+     * Parse result from Zend_Http_Response
+     *
+     * @param Zend_Http_Response $response Response from HTTP call
+     * @return object
+     * @throws Zend_Service_WindowsAzure_Exception
+     */
+    protected function _parseResponse(Zend_Http_Response $response = null)
+    {
+        if ($response === null) {
+            throw new Zend_Service_WindowsAzure_Exception('Response should not be null.');
+        }
+        
         $xml = @simplexml_load_string($response->getBody());
 
         if ($xml !== false) {
@@ -440,113 +440,113 @@ class Zend_Service_WindowsAzure_Storage
         }
 
         return $xml;
-	}
-	
-	/**
-	 * Generate metadata headers
-	 *
-	 * @param array $metadata
-	 * @return HTTP headers containing metadata
-	 */
-	protected function _generateMetadataHeaders($metadata = array())
-	{
-		// Validate
-		if (!is_array($metadata)) {
-			return array();
-		}
-		
-		// Return headers
-		$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.');
-			}
-			
-			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.');
-			}
-			
-		    $headers["x-ms-meta-" . strtolower($key)] = $value;
-		}
-		return $headers;
-	}
-	
-	/**
-	 * Parse metadata headers
-	 *
-	 * @param array $headers HTTP headers containing metadata
-	 * @return array
-	 */
-	protected function _parseMetadataHeaders($headers = array())
-	{
-		// Validate
-		if (!is_array($headers)) {
-			return array();
-		}
-		
-		// Return metadata
-		$metadata = array();
-		foreach ($headers as $key => $value) {
-		    if (substr(strtolower($key), 0, 10) == "x-ms-meta-") {
-		        $metadata[str_replace("x-ms-meta-", '', strtolower($key))] = $value;
-		    }
-		}
-		return $metadata;
-	}
-	
-	/**
-	 * Parse metadata XML
-	 *
-	 * @param SimpleXMLElement $parentElement Element containing the Metadata element.
-	 * @return array
-	 */
-	protected function _parseMetadataElement($element = null)
-	{
-		// Metadata present?
-		if ($element !== null && isset($element->Metadata) && $element->Metadata !== null) {
-			return get_object_vars($element->Metadata);
-		}
+    }
+    
+    /**
+     * Generate metadata headers
+     *
+     * @param array $metadata
+     * @return HTTP headers containing metadata
+     */
+    protected function _generateMetadataHeaders($metadata = array())
+    {
+        // Validate
+        if (!is_array($metadata)) {
+            return array();
+        }
+        
+        // Return headers
+        $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.');
+            }
+            
+            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.');
+            }
+            
+            $headers["x-ms-meta-" . strtolower($key)] = $value;
+        }
+        return $headers;
+    }
+    
+    /**
+     * Parse metadata headers
+     *
+     * @param array $headers HTTP headers containing metadata
+     * @return array
+     */
+    protected function _parseMetadataHeaders($headers = array())
+    {
+        // Validate
+        if (!is_array($headers)) {
+            return array();
+        }
+        
+        // Return metadata
+        $metadata = array();
+        foreach ($headers as $key => $value) {
+            if (substr(strtolower($key), 0, 10) == "x-ms-meta-") {
+                $metadata[str_replace("x-ms-meta-", '', strtolower($key))] = $value;
+            }
+        }
+        return $metadata;
+    }
+    
+    /**
+     * Parse metadata XML
+     *
+     * @param SimpleXMLElement $parentElement Element containing the Metadata element.
+     * @return array
+     */
+    protected function _parseMetadataElement($element = null)
+    {
+        // Metadata present?
+        if ($element !== null && isset($element->Metadata) && $element->Metadata !== null) {
+            return get_object_vars($element->Metadata);
+        }
 
-		return array();
-	}
-	
-	/**
-	 * Generate ISO 8601 compliant date string in UTC time zone
-	 *
-	 * @param int $timestamp
-	 * @return string
-	 */
-	public function isoDate($timestamp = null)
-	{
-	    $tz = @date_default_timezone_get();
-	    @date_default_timezone_set('UTC');
-	
-	    if ($timestamp === null) {
-	        $timestamp = time();
-	    }
-	
-	    $returnValue = str_replace('+00:00', '.0000000Z', @date('c', $timestamp));
-	    @date_default_timezone_set($tz);
-	    return $returnValue;
-	}
-	
-	/**
-	 * URL encode function
-	 *
-	 * @param  string $value Value to encode
-	 * @return string        Encoded value
-	 */
-	public static function urlencode($value)
-	{
-	    return str_replace(' ', '%20', $value);
-	}
-	
-	/**
-	 * Is valid metadata name?
-	 *
-	 * @param string $metadataName Metadata name
-	 * @return boolean
-	 */
+        return array();
+    }
+    
+    /**
+     * Generate ISO 8601 compliant date string in UTC time zone
+     *
+     * @param int $timestamp
+     * @return string
+     */
+    public function isoDate($timestamp = null)
+    {
+        $tz = @date_default_timezone_get();
+        @date_default_timezone_set('UTC');
+    
+        if ($timestamp === null) {
+            $timestamp = time();
+        }
+    
+        $returnValue = str_replace('+00:00', '.0000000Z', @date('c', $timestamp));
+        @date_default_timezone_set($tz);
+        return $returnValue;
+    }
+    
+    /**
+     * URL encode function
+     *
+     * @param  string $value Value to encode
+     * @return string        Encoded value
+     */
+    public static function urlencode($value)
+    {
+        return str_replace(' ', '%20', $value);
+    }
+    
+    /**
+     * Is valid metadata name?
+     *
+     * @param string $metadataName Metadata name
+     * @return boolean
+     */
     public static function isValidMetadataName($metadataName = '')
     {
         if (preg_match("/^[a-zA-Z0-9_@][a-zA-Z0-9_]*$/", $metadataName) === 0) {
@@ -568,6 +568,6 @@ class Zend_Service_WindowsAzure_Storage
      */
     public static function createQueryStringFromArray($queryString)
     {
-    	return count($queryString) > 0 ? '?' . implode('&', $queryString) : '';
-    }	
+        return count($queryString) > 0 ? '?' . implode('&', $queryString) : '';
+    }    
 }

+ 82 - 82
library/Zend/Service/WindowsAzure/Storage/Batch.php

@@ -38,7 +38,7 @@ require_once 'Zend/Service/WindowsAzure/Storage/BatchStorageAbstract.php';
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  */
 class Zend_Service_WindowsAzure_Storage_Batch
-{	
+{    
     /**
      * Storage client the batch is defined on
      *
@@ -86,15 +86,15 @@ class Zend_Service_WindowsAzure_Storage_Batch
         $this->_beginBatch();
     }
 
-	/**
-	 * Get base URL for creating requests
-	 *
-	 * @return string
-	 */
-	public function getBaseUrl()
-	{
-		return $this->_baseUrl;
-	}
+    /**
+     * Get base URL for creating requests
+     *
+     * @return string
+     */
+    public function getBaseUrl()
+    {
+        return $this->_baseUrl;
+    }
 
     /**
      * Starts a new batch operation set
@@ -117,78 +117,78 @@ class Zend_Service_WindowsAzure_Storage_Batch
         unset($this);
     }
 
-	/**
-	 * Enlist operation in current batch
-	 *
-	 * @param string $path Path
-	 * @param string $queryString Query string
-	 * @param string $httpVerb HTTP verb the request will use
-	 * @param array $headers x-ms headers to add
-	 * @param boolean $forTableStorage Is the request for table storage?
-	 * @param mixed $rawData Optional RAW HTTP data to be sent over the wire
-	 * @throws Zend_Service_WindowsAzure_Exception
-	 */
-	public function enlistOperation($path = '/', $queryString = '', $httpVerb = Zend_Http_Client::GET, $headers = array(), $forTableStorage = false, $rawData = null)
-	{
-	    // Set _forTableStorage
-	    if ($forTableStorage) {
-	        $this->_forTableStorage = true;
-	    }
-	
-	    // Set _isSingleSelect
-	    if ($httpVerb == Zend_Http_Client::GET) {
-	        if (count($this->_operations) > 0) {
-	            throw new Zend_Service_WindowsAzure_Exception("Select operations can only be performed in an empty batch transaction.");
-	        }
-	        $this->_isSingleSelect = true;
-	    }
-	
-	    // Clean path
-		if (strpos($path, '/') !== 0) {
-			$path = '/' . $path;
-		}
-			
-		// Clean headers
-		if ($headers === null) {
-		    $headers = array();
-		}
-		
-		// URL encoding
-		$path           = Zend_Service_WindowsAzure_Storage::urlencode($path);
-		$queryString    = Zend_Service_WindowsAzure_Storage::urlencode($queryString);
-
-		// Generate URL
-		$requestUrl     = $this->getBaseUrl() . $path . $queryString;
-		
-		// Generate $rawData
-		if ($rawData === null) {
-		    $rawData = '';
-		}
-		
-		// Add headers
-		if ($httpVerb != Zend_Http_Client::GET) {
-    		$headers['Content-ID'] = count($this->_operations) + 1;
-    		if ($httpVerb != Zend_Http_Client::DELETE) {
-    		    $headers['Content-Type'] = 'application/atom+xml;type=entry';
-    		}
-    		$headers['Content-Length'] = strlen($rawData);
-		}
-		
-		// Generate $operation
-		$operation = '';
-		$operation .= $httpVerb . ' ' . $requestUrl . ' HTTP/1.1' . "\n";
-		foreach ($headers as $key => $value)
-		{
-		    $operation .= $key . ': ' . $value . "\n";
-		}
-		$operation .= "\n";
-		
-		// Add data
-		$operation .= $rawData;
-
-		// Store operation
-		$this->_operations[] = $operation;	
-	}
+    /**
+     * Enlist operation in current batch
+     *
+     * @param string $path Path
+     * @param string $queryString Query string
+     * @param string $httpVerb HTTP verb the request will use
+     * @param array $headers x-ms headers to add
+     * @param boolean $forTableStorage Is the request for table storage?
+     * @param mixed $rawData Optional RAW HTTP data to be sent over the wire
+     * @throws Zend_Service_WindowsAzure_Exception
+     */
+    public function enlistOperation($path = '/', $queryString = '', $httpVerb = Zend_Http_Client::GET, $headers = array(), $forTableStorage = false, $rawData = null)
+    {
+        // Set _forTableStorage
+        if ($forTableStorage) {
+            $this->_forTableStorage = true;
+        }
+    
+        // Set _isSingleSelect
+        if ($httpVerb == Zend_Http_Client::GET) {
+            if (count($this->_operations) > 0) {
+                throw new Zend_Service_WindowsAzure_Exception("Select operations can only be performed in an empty batch transaction.");
+            }
+            $this->_isSingleSelect = true;
+        }
+    
+        // Clean path
+        if (strpos($path, '/') !== 0) {
+            $path = '/' . $path;
+        }
+            
+        // Clean headers
+        if ($headers === null) {
+            $headers = array();
+        }
+        
+        // URL encoding
+        $path           = Zend_Service_WindowsAzure_Storage::urlencode($path);
+        $queryString    = Zend_Service_WindowsAzure_Storage::urlencode($queryString);
+
+        // Generate URL
+        $requestUrl     = $this->getBaseUrl() . $path . $queryString;
+        
+        // Generate $rawData
+        if ($rawData === null) {
+            $rawData = '';
+        }
+        
+        // Add headers
+        if ($httpVerb != Zend_Http_Client::GET) {
+            $headers['Content-ID'] = count($this->_operations) + 1;
+            if ($httpVerb != Zend_Http_Client::DELETE) {
+                $headers['Content-Type'] = 'application/atom+xml;type=entry';
+            }
+            $headers['Content-Length'] = strlen($rawData);
+        }
+        
+        // Generate $operation
+        $operation = '';
+        $operation .= $httpVerb . ' ' . $requestUrl . ' HTTP/1.1' . "\n";
+        foreach ($headers as $key => $value)
+        {
+            $operation .= $key . ': ' . $value . "\n";
+        }
+        $operation .= "\n";
+        
+        // Add data
+        $operation .= $rawData;
+
+        // Store operation
+        $this->_operations[] = $operation;    
+    }
 
     /**
      * Commit current batch

+ 75 - 75
library/Zend/Service/WindowsAzure/Storage/BatchStorageAbstract.php

@@ -59,7 +59,7 @@ require_once 'Zend/Http/Response.php';
  */
 abstract class Zend_Service_WindowsAzure_Storage_BatchStorageAbstract
     extends Zend_Service_WindowsAzure_Storage
-{	
+{    
     /**
      * Current batch
      *
@@ -111,87 +111,87 @@ abstract class Zend_Service_WindowsAzure_Storage_BatchStorageAbstract
     {
         return new Zend_Service_WindowsAzure_Storage_Batch($this, $this->getBaseUrl());
     }
-	
-	/**
-	 * Perform batch using Zend_Http_Client channel, combining all batch operations into one request
-	 *
-	 * @param array $operations Operations in batch
-	 * @param boolean $forTableStorage Is the request for table storage?
-	 * @param boolean $isSingleSelect Is the request a single select statement?
-	 * @param string $resourceType Resource type
-	 * @param string $requiredPermission Required permission
-	 * @return Zend_Http_Response
-	 */
-	public function performBatch($operations = array(), $forTableStorage = false, $isSingleSelect = false, $resourceType = Zend_Service_WindowsAzure_Storage::RESOURCE_UNKNOWN, $requiredPermission = Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PERMISSION_READ)
-	{
-	    // Generate boundaries
-	    $batchBoundary = 'batch_' . md5(time() . microtime());
-	    $changesetBoundary = 'changeset_' . md5(time() . microtime());
-	
-	    // Set headers
-	    $headers = array();
-	
-		// Add version header
-		$headers['x-ms-version'] = $this->_apiVersion;
-		
-		// Add dataservice headers
-		$headers['DataServiceVersion'] = '1.0;NetFx';
-		$headers['MaxDataServiceVersion'] = '1.0;NetFx';
-		
-		// Add content-type header
-		$headers['Content-Type'] = 'multipart/mixed; boundary=' . $batchBoundary;
+    
+    /**
+     * Perform batch using Zend_Http_Client channel, combining all batch operations into one request
+     *
+     * @param array $operations Operations in batch
+     * @param boolean $forTableStorage Is the request for table storage?
+     * @param boolean $isSingleSelect Is the request a single select statement?
+     * @param string $resourceType Resource type
+     * @param string $requiredPermission Required permission
+     * @return Zend_Http_Response
+     */
+    public function performBatch($operations = array(), $forTableStorage = false, $isSingleSelect = false, $resourceType = Zend_Service_WindowsAzure_Storage::RESOURCE_UNKNOWN, $requiredPermission = Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PERMISSION_READ)
+    {
+        // Generate boundaries
+        $batchBoundary = 'batch_' . md5(time() . microtime());
+        $changesetBoundary = 'changeset_' . md5(time() . microtime());
+    
+        // Set headers
+        $headers = array();
+    
+        // Add version header
+        $headers['x-ms-version'] = $this->_apiVersion;
+        
+        // Add dataservice headers
+        $headers['DataServiceVersion'] = '1.0;NetFx';
+        $headers['MaxDataServiceVersion'] = '1.0;NetFx';
+        
+        // Add content-type header
+        $headers['Content-Type'] = 'multipart/mixed; boundary=' . $batchBoundary;
 
-		// Set path and query string
-		$path           = '/$batch';
-		$queryString    = '';
-		
-		// Set verb
-		$httpVerb = Zend_Http_Client::POST;
-		
-		// Generate raw data
-    	$rawData = '';
-    		
-		// Single select?
-		if ($isSingleSelect) {
-		    $operation = $operations[0];
-		    $rawData .= '--' . $batchBoundary . "\n";
+        // Set path and query string
+        $path           = '/$batch';
+        $queryString    = '';
+        
+        // Set verb
+        $httpVerb = Zend_Http_Client::POST;
+        
+        // Generate raw data
+        $rawData = '';
+            
+        // Single select?
+        if ($isSingleSelect) {
+            $operation = $operations[0];
+            $rawData .= '--' . $batchBoundary . "\n";
             $rawData .= 'Content-Type: application/http' . "\n";
             $rawData .= 'Content-Transfer-Encoding: binary' . "\n\n";
             $rawData .= $operation;
             $rawData .= '--' . $batchBoundary . '--';
-		} else {
-    		$rawData .= '--' . $batchBoundary . "\n";
-    		$rawData .= 'Content-Type: multipart/mixed; boundary=' . $changesetBoundary . "\n\n";
-    		
-        		// Add operations
-        		foreach ($operations as $operation)
-        		{
+        } else {
+            $rawData .= '--' . $batchBoundary . "\n";
+            $rawData .= 'Content-Type: multipart/mixed; boundary=' . $changesetBoundary . "\n\n";
+            
+                // Add operations
+                foreach ($operations as $operation)
+                {
                     $rawData .= '--' . $changesetBoundary . "\n";
-                	$rawData .= 'Content-Type: application/http' . "\n";
-                	$rawData .= 'Content-Transfer-Encoding: binary' . "\n\n";
-                	$rawData .= $operation;
-        		}
-        		$rawData .= '--' . $changesetBoundary . '--' . "\n";
-    		    		
-    		$rawData .= '--' . $batchBoundary . '--';
-		}
+                    $rawData .= 'Content-Type: application/http' . "\n";
+                    $rawData .= 'Content-Transfer-Encoding: binary' . "\n\n";
+                    $rawData .= $operation;
+                }
+                $rawData .= '--' . $changesetBoundary . '--' . "\n";
+                        
+            $rawData .= '--' . $batchBoundary . '--';
+        }
 
-		// Generate URL and sign request
-		$requestUrl     = $this->_credentials->signRequestUrl($this->getBaseUrl() . $path . $queryString, $resourceType, $requiredPermission);
-		$requestHeaders = $this->_credentials->signRequestHeaders($httpVerb, $path, $queryString, $headers, $forTableStorage, $resourceType, $requiredPermission);
+        // Generate URL and sign request
+        $requestUrl     = $this->_credentials->signRequestUrl($this->getBaseUrl() . $path . $queryString, $resourceType, $requiredPermission);
+        $requestHeaders = $this->_credentials->signRequestHeaders($httpVerb, $path, $queryString, $headers, $forTableStorage, $resourceType, $requiredPermission);
 
-		// Prepare request
-		$this->_httpClientChannel->resetParameters(true);
-		$this->_httpClientChannel->setUri($requestUrl);
-		$this->_httpClientChannel->setHeaders($requestHeaders);
-		$this->_httpClientChannel->setRawData($rawData);
-		
-		// Execute request
-		$response = $this->_retryPolicy->execute(
-		    array($this->_httpClientChannel, 'request'),
-		    array($httpVerb)
-		);
+        // Prepare request
+        $this->_httpClientChannel->resetParameters(true);
+        $this->_httpClientChannel->setUri($requestUrl);
+        $this->_httpClientChannel->setHeaders($requestHeaders);
+        $this->_httpClientChannel->setRawData($rawData);
+        
+        // Execute request
+        $response = $this->_retryPolicy->execute(
+            array($this->_httpClientChannel, 'request'),
+            array($httpVerb)
+        );
 
-		return $response;
-	}
+        return $response;
+    }
 }

+ 1908 - 1908
library/Zend/Service/WindowsAzure/Storage/Blob.php

@@ -90,1912 +90,1912 @@ require_once 'Zend/Service/WindowsAzure/Exception.php';
  */
 class Zend_Service_WindowsAzure_Storage_Blob extends Zend_Service_WindowsAzure_Storage
 {
-	/**
-	 * ACL - Private access
-	 */
-	const ACL_PRIVATE = null;
-
-	/**
-	 * ACL - Public access (read all blobs)
-	 *
-	 * @deprecated Use ACL_PUBLIC_CONTAINER or ACL_PUBLIC_BLOB instead.
-	 */
-	const ACL_PUBLIC = 'container';
-	
-	/**
-	 * ACL - Blob Public access (read all blobs)
-	 */
-	const ACL_PUBLIC_BLOB = 'blob';
-
-	/**
-	 * ACL - Container Public access (enumerate and read all blobs)
-	 */
-	const ACL_PUBLIC_CONTAINER = 'container';
-
-	/**
-	 * Blob lease constants
-	 */
-	const LEASE_ACQUIRE = 'acquire';
-	const LEASE_RENEW   = 'renew';
-	const LEASE_RELEASE = 'release';
-	const LEASE_BREAK   = 'break';
-
-	/**
-	 * Maximal blob size (in bytes)
-	 */
-	const MAX_BLOB_SIZE = 67108864;
-
-	/**
-	 * Maximal blob transfer size (in bytes)
-	 */
-	const MAX_BLOB_TRANSFER_SIZE = 4194304;
-
-	/**
-	 * Blob types
-	 */
-	const BLOBTYPE_BLOCK = 'BlockBlob';
-	const BLOBTYPE_PAGE  = 'PageBlob';
-
-	/**
-	 * Put page write options
-	 */
-	const PAGE_WRITE_UPDATE = 'update';
-	const PAGE_WRITE_CLEAR  = 'clear';
-
-	/**
-	 * Stream wrapper clients
-	 *
-	 * @var array
-	 */
-	protected static $_wrapperClients = array();
-
-	/**
-	 * SharedAccessSignature credentials
-	 *
-	 * @var Zend_Service_WindowsAzure_Credentials_SharedAccessSignature
-	 */
-	private $_sharedAccessSignatureCredentials = null;
-
-	/**
-	 * Creates a new Zend_Service_WindowsAzure_Storage_Blob instance
-	 *
-	 * @param string $host Storage host name
-	 * @param string $accountName Account name for Windows Azure
-	 * @param string $accountKey Account key for Windows Azure
-	 * @param boolean $usePathStyleUri Use path-style URI's
-	 * @param Zend_Service_WindowsAzure_RetryPolicy_RetryPolicyAbstract $retryPolicy Retry policy to use when making requests
-	 */
-	public function __construct($host = Zend_Service_WindowsAzure_Storage::URL_DEV_BLOB, $accountName = Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::DEVSTORE_ACCOUNT, $accountKey = Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::DEVSTORE_KEY, $usePathStyleUri = false, Zend_Service_WindowsAzure_RetryPolicy_RetryPolicyAbstract $retryPolicy = null)
-	{
-		parent::__construct($host, $accountName, $accountKey, $usePathStyleUri, $retryPolicy);
-
-		// API version
-		$this->_apiVersion = '2009-09-19';
-
-		// SharedAccessSignature credentials
-		$this->_sharedAccessSignatureCredentials = new Zend_Service_WindowsAzure_Credentials_SharedAccessSignature($accountName, $accountKey, $usePathStyleUri);
-	}
-
-	/**
-	 * Check if a blob exists
-	 *
-	 * @param string $containerName Container name
-	 * @param string $blobName      Blob name
-	 * @param string $snapshotId    Snapshot identifier
-	 * @return boolean
-	 */
-	public function blobExists($containerName = '', $blobName = '', $snapshotId = null)
-	{
-		if ($containerName === '') {
-			throw new Zend_Service_WindowsAzure_Exception('Container name is not specified.');
-		}
-		if (!self::isValidContainerName($containerName)) {
-			throw new Zend_Service_WindowsAzure_Exception('Container name does not adhere to container naming conventions. See http://msdn.microsoft.com/en-us/library/dd135715.aspx for more information.');
-		}
-		if ($blobName === '') {
-			throw new Zend_Service_WindowsAzure_Exception('Blob name is not specified.');
-		}
-
-		// Get blob instance
-		try {
-			$this->getBlobInstance($containerName, $blobName, $snapshotId);
-		} catch (Zend_Service_WindowsAzure_Exception $e) {
-			return false;
-		}
-
-		return true;
-	}
-
-	/**
-	 * Check if a container exists
-	 *
-	 * @param string $containerName Container name
-	 * @return boolean
-	 */
-	public function containerExists($containerName = '')
-	{
-		if ($containerName === '') {
-			throw new Zend_Service_WindowsAzure_Exception('Container name is not specified.');
-		}
-		if (!self::isValidContainerName($containerName)) {
-			throw new Zend_Service_WindowsAzure_Exception('Container name does not adhere to container naming conventions. See http://msdn.microsoft.com/en-us/library/dd135715.aspx for more information.');
-		}
-			
-		// List containers
-		$containers = $this->listContainers($containerName, 1);
-		foreach ($containers as $container) {
-			if ($container->Name == $containerName) {
-				return true;
-			}
-		}
-
-		return false;
-	}
-
-	/**
-	 * Create container
-	 *
-	 * @param string $containerName Container name
-	 * @param array  $metadata      Key/value pairs of meta data
-	 * @return object Container properties
-	 * @throws Zend_Service_WindowsAzure_Exception
-	 */
-	public function createContainer($containerName = '', $metadata = array())
-	{
-		if ($containerName === '') {
-			throw new Zend_Service_WindowsAzure_Exception('Container name is not specified.');
-		}
-		if (!self::isValidContainerName($containerName)) {
-			throw new Zend_Service_WindowsAzure_Exception('Container name does not adhere to container naming conventions. See http://msdn.microsoft.com/en-us/library/dd135715.aspx for more information.');
-		}
-		if (!is_array($metadata)) {
-			throw new Zend_Service_WindowsAzure_Exception('Meta data should be an array of key and value pairs.');
-		}
-			
-		// Create metadata headers
-		$headers = array();
-		$headers = array_merge($headers, $this->_generateMetadataHeaders($metadata));
-
-		// Perform request
-		$response = $this->_performRequest($containerName, '?restype=container', Zend_Http_Client::PUT, $headers, false, null, Zend_Service_WindowsAzure_Storage::RESOURCE_CONTAINER, Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PERMISSION_WRITE);
-		if ($response->isSuccessful()) {
-			return new Zend_Service_WindowsAzure_Storage_BlobContainer(
-			$containerName,
-			$response->getHeader('Etag'),
-			$response->getHeader('Last-modified'),
-			$metadata
-			);
-		} else {
-			throw new Zend_Service_WindowsAzure_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
-		}
-	}
-
-	/**
-	 * Get container ACL
-	 *
-	 * @param string $containerName Container name
-	 * @param bool   $signedIdentifiers Display only private/blob/container or display signed identifiers?
-	 * @return string Acl, to be compared with Zend_Service_WindowsAzure_Storage_Blob::ACL_*
-	 * @throws Zend_Service_WindowsAzure_Exception
-	 */
-	public function getContainerAcl($containerName = '', $signedIdentifiers = false)
-	{
-		if ($containerName === '') {
-			throw new Zend_Service_WindowsAzure_Exception('Container name is not specified.');
-		}
-		if (!self::isValidContainerName($containerName)) {
-			throw new Zend_Service_WindowsAzure_Exception('Container name does not adhere to container naming conventions. See http://msdn.microsoft.com/en-us/library/dd135715.aspx for more information.');
-		}
-
-		// Perform request
-		$response = $this->_performRequest($containerName, '?restype=container&comp=acl', Zend_Http_Client::GET, array(), false, null, Zend_Service_WindowsAzure_Storage::RESOURCE_CONTAINER, Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PERMISSION_READ);
-		if ($response->isSuccessful()) {
-			if ($signedIdentifiers == false)  {
-				// Only private/blob/container
-				$accessType = $response->getHeader(Zend_Service_WindowsAzure_Storage::PREFIX_STORAGE_HEADER . 'blob-public-access');
-				if (strtolower($accessType) == 'true') {
-					$accessType = self::ACL_PUBLIC_CONTAINER;
-				}
-				return $accessType;
-			} else {
-				// Parse result
-				$result = $this->_parseResponse($response);
-				if (!$result) {
-					return array();
-				}
-
-				$entries = null;
-				if ($result->SignedIdentifier) {
-					if (count($result->SignedIdentifier) > 1) {
-						$entries = $result->SignedIdentifier;
-					} else {
-						$entries = array($result->SignedIdentifier);
-					}
-				}
-
-				// Return value
-				$returnValue = array();
-				foreach ($entries as $entry) {
-					$returnValue[] = new Zend_Service_WindowsAzure_Storage_SignedIdentifier(
-					$entry->Id,
-					$entry->AccessPolicy ? $entry->AccessPolicy->Start ? $entry->AccessPolicy->Start : '' : '',
-					$entry->AccessPolicy ? $entry->AccessPolicy->Expiry ? $entry->AccessPolicy->Expiry : '' : '',
-					$entry->AccessPolicy ? $entry->AccessPolicy->Permission ? $entry->AccessPolicy->Permission : '' : ''
-					);
-				}
-
-				// Return
-				return $returnValue;
-			}
-		} else {
-			throw new Zend_Service_WindowsAzure_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
-		}
-	}
-
-	/**
-	 * Set container ACL
-	 *
-	 * @param string $containerName Container name
-	 * @param bool $acl Zend_Service_WindowsAzure_Storage_Blob::ACL_*
-	 * @param array $signedIdentifiers Signed identifiers
-	 * @throws Zend_Service_WindowsAzure_Exception
-	 */
-	public function setContainerAcl($containerName = '', $acl = self::ACL_PRIVATE, $signedIdentifiers = array())
-	{
-		if ($containerName === '') {
-			throw new Zend_Service_WindowsAzure_Exception('Container name is not specified.');
-		}
-		if (!self::isValidContainerName($containerName)) {
-			throw new Zend_Service_WindowsAzure_Exception('Container name does not adhere to container naming conventions. See http://msdn.microsoft.com/en-us/library/dd135715.aspx for more information.');
-		}
-
-		// Headers
-		$headers = array();
-
-		// Acl specified?
-		if ($acl != self::ACL_PRIVATE && $acl !== null && $acl != '') {
-			$headers[Zend_Service_WindowsAzure_Storage::PREFIX_STORAGE_HEADER . 'blob-public-access'] = $acl;
-		}
-
-		// Policies
-		$policies = null;
-		if (is_array($signedIdentifiers) && count($signedIdentifiers) > 0) {
-			$policies  = '';
-			$policies .= '<?xml version="1.0" encoding="utf-8"?>' . "\r\n";
-			$policies .= '<SignedIdentifiers>' . "\r\n";
-			foreach ($signedIdentifiers as $signedIdentifier) {
-				$policies .= '  <SignedIdentifier>' . "\r\n";
-				$policies .= '    <Id>' . $signedIdentifier->Id . '</Id>' . "\r\n";
-				$policies .= '    <AccessPolicy>' . "\r\n";
-				if ($signedIdentifier->Start != '')
-				$policies .= '      <Start>' . $signedIdentifier->Start . '</Start>' . "\r\n";
-				if ($signedIdentifier->Expiry != '')
-				$policies .= '      <Expiry>' . $signedIdentifier->Expiry . '</Expiry>' . "\r\n";
-				if ($signedIdentifier->Permissions != '')
-				$policies .= '      <Permission>' . $signedIdentifier->Permissions . '</Permission>' . "\r\n";
-				$policies .= '    </AccessPolicy>' . "\r\n";
-				$policies .= '  </SignedIdentifier>' . "\r\n";
-			}
-			$policies .= '</SignedIdentifiers>' . "\r\n";
-		}
-
-		// Perform request
-		$response = $this->_performRequest($containerName, '?restype=container&comp=acl', Zend_Http_Client::PUT, $headers, false, $policies, Zend_Service_WindowsAzure_Storage::RESOURCE_CONTAINER, Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PERMISSION_WRITE);
-		if (!$response->isSuccessful()) {
-			throw new Zend_Service_WindowsAzure_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
-		}
-	}
-
-	/**
-	 * Get container
-	 *
-	 * @param string $containerName  Container name
-	 * @return Zend_Service_WindowsAzure_Storage_BlobContainer
-	 * @throws Zend_Service_WindowsAzure_Exception
-	 */
-	public function getContainer($containerName = '')
-	{
-		if ($containerName === '') {
-			throw new Zend_Service_WindowsAzure_Exception('Container name is not specified.');
-		}
-		if (!self::isValidContainerName($containerName)) {
-			throw new Zend_Service_WindowsAzure_Exception('Container name does not adhere to container naming conventions. See http://msdn.microsoft.com/en-us/library/dd135715.aspx for more information.');
-		}
-
-		// Perform request
-		$response = $this->_performRequest($containerName, '?restype=container', Zend_Http_Client::GET, array(), false, null, Zend_Service_WindowsAzure_Storage::RESOURCE_CONTAINER, Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PERMISSION_READ);
-		if ($response->isSuccessful()) {
-			// Parse metadata
-			$metadata = $this->_parseMetadataHeaders($response->getHeaders());
-
-			// Return container
-			return new Zend_Service_WindowsAzure_Storage_BlobContainer(
-			$containerName,
-			$response->getHeader('Etag'),
-			$response->getHeader('Last-modified'),
-			$metadata
-			);
-		} else {
-			throw new Zend_Service_WindowsAzure_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
-		}
-	}
-
-	/**
-	 * Get container metadata
-	 *
-	 * @param string $containerName  Container name
-	 * @return array Key/value pairs of meta data
-	 * @throws Zend_Service_WindowsAzure_Exception
-	 */
-	public function getContainerMetadata($containerName = '')
-	{
-		if ($containerName === '') {
-			throw new Zend_Service_WindowsAzure_Exception('Container name is not specified.');
-		}
-		if (!self::isValidContainerName($containerName)) {
-			throw new Zend_Service_WindowsAzure_Exception('Container name does not adhere to container naming conventions. See http://msdn.microsoft.com/en-us/library/dd135715.aspx for more information.');
-		}
-
-		return $this->getContainer($containerName)->Metadata;
-	}
-
-	/**
-	 * Set container metadata
-	 *
-	 * Calling the Set Container Metadata operation overwrites all existing metadata that is associated with the container. It's not possible to modify an individual name/value pair.
-	 *
-	 * @param string $containerName      Container name
-	 * @param array  $metadata           Key/value pairs of meta data
-	 * @param array  $additionalHeaders  Additional headers. See http://msdn.microsoft.com/en-us/library/dd179371.aspx for more information.
-	 * @throws Zend_Service_WindowsAzure_Exception
-	 */
-	public function setContainerMetadata($containerName = '', $metadata = array(), $additionalHeaders = array())
-	{
-		if ($containerName === '') {
-			throw new Zend_Service_WindowsAzure_Exception('Container name is not specified.');
-		}
-		if (!self::isValidContainerName($containerName)) {
-			throw new Zend_Service_WindowsAzure_Exception('Container name does not adhere to container naming conventions. See http://msdn.microsoft.com/en-us/library/dd135715.aspx for more information.');
-		}
-		if (!is_array($metadata)) {
-			throw new Zend_Service_WindowsAzure_Exception('Meta data should be an array of key and value pairs.');
-		}
-		if (count($metadata) == 0) {
-			return;
-		}
-
-		// Create metadata headers
-		$headers = array();
-		$headers = array_merge($headers, $this->_generateMetadataHeaders($metadata));
-
-		// Additional headers?
-		foreach ($additionalHeaders as $key => $value) {
-			$headers[$key] = $value;
-		}
-
-		// Perform request
-		$response = $this->_performRequest($containerName, '?restype=container&comp=metadata', Zend_Http_Client::PUT, $headers, false, null, Zend_Service_WindowsAzure_Storage::RESOURCE_CONTAINER, Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PERMISSION_WRITE);
-		if (!$response->isSuccessful()) {
-			throw new Zend_Service_WindowsAzure_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
-		}
-	}
-
-	/**
-	 * Delete container
-	 *
-	 * @param string $containerName      Container name
-	 * @param array  $additionalHeaders  Additional headers. See http://msdn.microsoft.com/en-us/library/dd179371.aspx for more information.
-	 * @throws Zend_Service_WindowsAzure_Exception
-	 */
-	public function deleteContainer($containerName = '', $additionalHeaders = array())
-	{
-		if ($containerName === '') {
-			throw new Zend_Service_WindowsAzure_Exception('Container name is not specified.');
-		}
-		if (!self::isValidContainerName($containerName)) {
-			throw new Zend_Service_WindowsAzure_Exception('Container name does not adhere to container naming conventions. See http://msdn.microsoft.com/en-us/library/dd135715.aspx for more information.');
-		}
-			
-		// Additional headers?
-		$headers = array();
-		foreach ($additionalHeaders as $key => $value) {
-			$headers[$key] = $value;
-		}
-
-		// Perform request
-		$response = $this->_performRequest($containerName, '?restype=container', Zend_Http_Client::DELETE, $headers, false, null, Zend_Service_WindowsAzure_Storage::RESOURCE_CONTAINER, Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PERMISSION_WRITE);
-		if (!$response->isSuccessful()) {
-			throw new Zend_Service_WindowsAzure_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
-		}
-	}
-
-	/**
-	 * List containers
-	 *
-	 * @param string $prefix     Optional. Filters the results to return only containers whose name begins with the specified prefix.
-	 * @param int    $maxResults Optional. Specifies the maximum number of containers to return per call to Azure storage. This does NOT affect list size returned by this function. (maximum: 5000)
-	 * @param string $marker     Optional string value that identifies the portion of the list to be returned with the next list operation.
-	 * @param string $include    Optional. Include this parameter to specify that the container's metadata be returned as part of the response body. (allowed values: '', 'metadata')
-	 * @param int    $currentResultCount Current result count (internal use)
-	 * @return array
-	 * @throws Zend_Service_WindowsAzure_Exception
-	 */
-	public function listContainers($prefix = null, $maxResults = null, $marker = null, $include = null, $currentResultCount = 0)
-	{
-		// Build query string
-		$queryString = array('comp=list');
-		if ($prefix !== null) {
-			$queryString[] = 'prefix=' . $prefix;
-		}
-		if ($maxResults !== null) {
-			$queryString[] = 'maxresults=' . $maxResults;
-		}
-		if ($marker !== null) {
-			$queryString[] = 'marker=' . $marker;
-		}
-		if ($include !== null) {
-			$queryString[] = 'include=' . $include;
-		}
-		$queryString = self::createQueryStringFromArray($queryString);
-		
-		// Perform request
-		$response = $this->_performRequest('', $queryString, Zend_Http_Client::GET, array(), false, null, Zend_Service_WindowsAzure_Storage::RESOURCE_CONTAINER, Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PERMISSION_LIST);
-		if ($response->isSuccessful()) {
-			$xmlContainers = $this->_parseResponse($response)->Containers->Container;
-			$xmlMarker = (string)$this->_parseResponse($response)->NextMarker;
-
-			$containers = array();
-			if ($xmlContainers !== null) {
-				for ($i = 0; $i < count($xmlContainers); $i++) {
-					$containers[] = new Zend_Service_WindowsAzure_Storage_BlobContainer(
-					(string)$xmlContainers[$i]->Name,
-					(string)$xmlContainers[$i]->Etag,
-					(string)$xmlContainers[$i]->LastModified,
-					$this->_parseMetadataElement($xmlContainers[$i])
-					);
-				}
-			}
-			$currentResultCount = $currentResultCount + count($containers);
-			if ($maxResults !== null && $currentResultCount < $maxResults) {
-				if ($xmlMarker !== null && $xmlMarker != '') {
-					$containers = array_merge($containers, $this->listContainers($prefix, $maxResults, $xmlMarker, $include, $currentResultCount));
-				}
-			}
-			if ($maxResults !== null && count($containers) > $maxResults) {
-				$containers = array_slice($containers, 0, $maxResults);
-			}
-			
-			return $containers;
-		} else {
-			throw new Zend_Service_WindowsAzure_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
-		}
-	}
-
-	/**
-	 * Put blob
-	 *
-	 * @param string $containerName      Container name
-	 * @param string $blobName           Blob name
-	 * @param string $localFileName      Local file name to be uploaded
-	 * @param array  $metadata           Key/value pairs of meta data
-	 * @param string $leaseId            Lease identifier
-	 * @param array  $additionalHeaders  Additional headers. See http://msdn.microsoft.com/en-us/library/dd179371.aspx for more information.
-	 * @return object Partial blob properties
-	 * @throws Zend_Service_WindowsAzure_Exception
-	 */
-	public function putBlob($containerName = '', $blobName = '', $localFileName = '', $metadata = array(), $leaseId = null, $additionalHeaders = array())
-	{
-		if ($containerName === '') {
-			throw new Zend_Service_WindowsAzure_Exception('Container name is not specified.');
-		}
-		if (!self::isValidContainerName($containerName)) {
-			throw new Zend_Service_WindowsAzure_Exception('Container name does not adhere to container naming conventions. See http://msdn.microsoft.com/en-us/library/dd135715.aspx for more information.');
-		}
-		if ($blobName === '') {
-			throw new Zend_Service_WindowsAzure_Exception('Blob name is not specified.');
-		}
-		if ($localFileName === '') {
-			throw new Zend_Service_WindowsAzure_Exception('Local file name is not specified.');
-		}
-		if (!file_exists($localFileName)) {
-			throw new Zend_Service_WindowsAzure_Exception('Local file not found.');
-		}
-		if ($containerName === '$root' && strpos($blobName, '/') !== false) {
-			throw new Zend_Service_WindowsAzure_Exception('Blobs stored in the root container can not have a name containing a forward slash (/).');
-		}
-			
-		// Check file size
-		if (filesize($localFileName) >= self::MAX_BLOB_SIZE) {
-			return $this->putLargeBlob($containerName, $blobName, $localFileName, $metadata, $leaseId);
-		}
-
-		// Put the data to Windows Azure Storage
-		return $this->putBlobData($containerName, $blobName, file_get_contents($localFileName), $metadata, $leaseId, $additionalHeaders);
-	}
-
-	/**
-	 * Put blob data
-	 *
-	 * @param string $containerName      Container name
-	 * @param string $blobName           Blob name
-	 * @param mixed  $data      		 Data to store
-	 * @param array  $metadata           Key/value pairs of meta data
-	 * @param string $leaseId            Lease identifier
-	 * @param array  $additionalHeaders  Additional headers. See http://msdn.microsoft.com/en-us/library/dd179371.aspx for more information.
-	 * @return object Partial blob properties
-	 * @throws Zend_Service_WindowsAzure_Exception
-	 */
-	public function putBlobData($containerName = '', $blobName = '', $data = '', $metadata = array(), $leaseId = null, $additionalHeaders = array())
-	{
-		if ($containerName === '') {
-			throw new Zend_Service_WindowsAzure_Exception('Container name is not specified.');
-		}
-		if (!self::isValidContainerName($containerName)) {
-			throw new Zend_Service_WindowsAzure_Exception('Container name does not adhere to container naming conventions. See http://msdn.microsoft.com/en-us/library/dd135715.aspx for more information.');
-		}
-		if ($blobName === '') {
-			throw new Zend_Service_WindowsAzure_Exception('Blob name is not specified.');
-		}
-		if ($containerName === '$root' && strpos($blobName, '/') !== false) {
-			throw new Zend_Service_WindowsAzure_Exception('Blobs stored in the root container can not have a name containing a forward slash (/).');
-		}
-
-		// Create metadata headers
-		$headers = array();
-		if ($leaseId !== null) {
-			$headers['x-ms-lease-id'] = $leaseId;
-		}
-		$headers = array_merge($headers, $this->_generateMetadataHeaders($metadata));
-
-		// Additional headers?
-		foreach ($additionalHeaders as $key => $value) {
-			$headers[$key] = $value;
-		}
-
-		// Specify blob type
-		$headers[Zend_Service_WindowsAzure_Storage::PREFIX_STORAGE_HEADER . 'blob-type'] = self::BLOBTYPE_BLOCK;
-
-		// Resource name
-		$resourceName = self::createResourceName($containerName , $blobName);
-
-		// Perform request
-		$response = $this->_performRequest($resourceName, '', Zend_Http_Client::PUT, $headers, false, $data, Zend_Service_WindowsAzure_Storage::RESOURCE_BLOB, Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PERMISSION_WRITE);
-		if ($response->isSuccessful()) {
-			return new Zend_Service_WindowsAzure_Storage_BlobInstance(
-			$containerName,
-			$blobName,
-			null,
-			$response->getHeader('Etag'),
-			$response->getHeader('Last-modified'),
-			$this->getBaseUrl() . '/' . $containerName . '/' . $blobName,
-			strlen($data),
-				'',
-				'',
-				'',
-			false,
-			$metadata
-			);
-		} else {
-			throw new Zend_Service_WindowsAzure_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
-		}
-	}
-
-	/**
-	 * Put large blob (> 64 MB)
-	 *
-	 * @param string $containerName Container name
-	 * @param string $blobName Blob name
-	 * @param string $localFileName Local file name to be uploaded
-	 * @param array  $metadata      Key/value pairs of meta data
-	 * @param string $leaseId       Lease identifier
-	 * @return object Partial blob properties
-	 * @throws Zend_Service_WindowsAzure_Exception
-	 */
-	public function putLargeBlob($containerName = '', $blobName = '', $localFileName = '', $metadata = array(), $leaseId = null)
-	{
-		if ($containerName === '') {
-			throw new Zend_Service_WindowsAzure_Exception('Container name is not specified.');
-		}
-		if (!self::isValidContainerName($containerName)) {
-			throw new Zend_Service_WindowsAzure_Exception('Container name does not adhere to container naming conventions. See http://msdn.microsoft.com/en-us/library/dd135715.aspx for more information.');
-		}
-		if ($blobName === '') {
-			throw new Zend_Service_WindowsAzure_Exception('Blob name is not specified.');
-		}
-		if ($localFileName === '') {
-			throw new Zend_Service_WindowsAzure_Exception('Local file name is not specified.');
-		}
-		if (!file_exists($localFileName)) {
-			throw new Zend_Service_WindowsAzure_Exception('Local file not found.');
-		}
-		if ($containerName === '$root' && strpos($blobName, '/') !== false) {
-			throw new Zend_Service_WindowsAzure_Exception('Blobs stored in the root container can not have a name containing a forward slash (/).');
-		}
-			
-		// Check file size
-		if (filesize($localFileName) < self::MAX_BLOB_SIZE) {
-			return $this->putBlob($containerName, $blobName, $localFileName, $metadata);
-		}
-			
-		// Determine number of parts
-		$numberOfParts = ceil( filesize($localFileName) / self::MAX_BLOB_TRANSFER_SIZE );
-
-		// Generate block id's
-		$blockIdentifiers = array();
-		for ($i = 0; $i < $numberOfParts; $i++) {
-			$blockIdentifiers[] = $this->_generateBlockId($i);
-		}
-
-		// Open file
-		$fp = fopen($localFileName, 'r');
-		if ($fp === false) {
-			throw new Zend_Service_WindowsAzure_Exception('Could not open local file.');
-		}
-			
-		// Upload parts
-		for ($i = 0; $i < $numberOfParts; $i++) {
-			// Seek position in file
-			fseek($fp, $i * self::MAX_BLOB_TRANSFER_SIZE);
-				
-			// Read contents
-			$fileContents = fread($fp, self::MAX_BLOB_TRANSFER_SIZE);
-				
-			// Put block
-			$this->putBlock($containerName, $blobName, $blockIdentifiers[$i], $fileContents, $leaseId);
-				
-			// Dispose file contents
-			$fileContents = null;
-			unset($fileContents);
-		}
-
-		// Close file
-		fclose($fp);
-
-		// Put block list
-		$this->putBlockList($containerName, $blobName, $blockIdentifiers, $metadata, $leaseId);
-
-		// Return information of the blob
-		return $this->getBlobInstance($containerName, $blobName, null, $leaseId);
-	}
-		
-	/**
-	 * Put large blob block
-	 *
-	 * @param string $containerName Container name
-	 * @param string $blobName      Blob name
-	 * @param string $identifier    Block ID
-	 * @param array  $contents      Contents of the block
-	 * @param string $leaseId       Lease identifier
-	 * @throws Zend_Service_WindowsAzure_Exception
-	 */
-	public function putBlock($containerName = '', $blobName = '', $identifier = '', $contents = '', $leaseId = null)
-	{
-		if ($containerName === '') {
-			throw new Zend_Service_WindowsAzure_Exception('Container name is not specified.');
-		}
-		if (!self::isValidContainerName($containerName)) {
-			throw new Zend_Service_WindowsAzure_Exception('Container name does not adhere to container naming conventions. See http://msdn.microsoft.com/en-us/library/dd135715.aspx for more information.');
-		}
-		if ($identifier === '') {
-			throw new Zend_Service_WindowsAzure_Exception('Block identifier is not specified.');
-		}
-		if (strlen($contents) > self::MAX_BLOB_TRANSFER_SIZE) {
-			throw new Zend_Service_WindowsAzure_Exception('Block size is too big.');
-		}
-		if ($containerName === '$root' && strpos($blobName, '/') !== false) {
-			throw new Zend_Service_WindowsAzure_Exception('Blobs stored in the root container can not have a name containing a forward slash (/).');
-		}
-
-		// Headers
-		$headers = array();
-		if ($leaseId !== null) {
-			$headers['x-ms-lease-id'] = $leaseId;
-		}
-			
-		// Resource name
-		$resourceName = self::createResourceName($containerName , $blobName);
-
-		// Upload
-		$response = $this->_performRequest($resourceName, '?comp=block&blockid=' . base64_encode($identifier), Zend_Http_Client::PUT, $headers, false, $contents, Zend_Service_WindowsAzure_Storage::RESOURCE_BLOB, Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PERMISSION_WRITE);
-		if (!$response->isSuccessful()) {
-			throw new Zend_Service_WindowsAzure_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
-		}
-	}
-
-	/**
-	 * Put block list
-	 *
-	 * @param string $containerName      Container name
-	 * @param string $blobName           Blob name
-	 * @param array $blockList           Array of block identifiers
-	 * @param array  $metadata           Key/value pairs of meta data
-	 * @param string $leaseId            Lease identifier
-	 * @param array  $additionalHeaders  Additional headers. See http://msdn.microsoft.com/en-us/library/dd179371.aspx for more information.
-	 * @throws Zend_Service_WindowsAzure_Exception
-	 */
-	public function putBlockList($containerName = '', $blobName = '', $blockList = array(), $metadata = array(), $leaseId = null, $additionalHeaders = array())
-	{
-		if ($containerName === '') {
-			throw new Zend_Service_WindowsAzure_Exception('Container name is not specified.');
-		}
-		if (!self::isValidContainerName($containerName)) {
-			throw new Zend_Service_WindowsAzure_Exception('Container name does not adhere to container naming conventions. See http://msdn.microsoft.com/en-us/library/dd135715.aspx for more information.');
-		}
-		if ($blobName === '') {
-			throw new Zend_Service_WindowsAzure_Exception('Blob name is not specified.');
-		}
-		if (count($blockList) == 0) {
-			throw new Zend_Service_WindowsAzure_Exception('Block list does not contain any elements.');
-		}
-		if ($containerName === '$root' && strpos($blobName, '/') !== false) {
-			throw new Zend_Service_WindowsAzure_Exception('Blobs stored in the root container can not have a name containing a forward slash (/).');
-		}
-
-		// Generate block list
-		$blocks = '';
-		foreach ($blockList as $block) {
-			$blocks .= '  <Latest>' . base64_encode($block) . '</Latest>' . "\n";
-		}
-
-		// Generate block list request
-		$fileContents = utf8_encode(implode("\n", array(
-			'<?xml version="1.0" encoding="utf-8"?>',
-			'<BlockList>',
-		$blocks,
-			'</BlockList>'
-			)));
-
-			// Create metadata headers
-			$headers = array();
-			if ($leaseId !== null) {
-				$headers['x-ms-lease-id'] = $leaseId;
-			}
-			$headers = array_merge($headers, $this->_generateMetadataHeaders($metadata));
-
-			// Additional headers?
-			foreach ($additionalHeaders as $key => $value) {
-				$headers[$key] = $value;
-			}
-
-			// Resource name
-			$resourceName = self::createResourceName($containerName , $blobName);
-
-			// Perform request
-			$response = $this->_performRequest($resourceName, '?comp=blocklist', Zend_Http_Client::PUT, $headers, false, $fileContents, Zend_Service_WindowsAzure_Storage::RESOURCE_BLOB, Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PERMISSION_WRITE);
-			if (!$response->isSuccessful()) {
-				throw new Zend_Service_WindowsAzure_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
-			}
-	}
-
-	/**
-	 * Get block list
-	 *
-	 * @param string $containerName Container name
-	 * @param string $blobName      Blob name
-	 * @param string $snapshotId    Snapshot identifier
-	 * @param string $leaseId       Lease identifier
-	 * @param integer $type         Type of block list to retrieve. 0 = all, 1 = committed, 2 = uncommitted
-	 * @return array
-	 * @throws Zend_Service_WindowsAzure_Exception
-	 */
-	public function getBlockList($containerName = '', $blobName = '', $snapshotId = null, $leaseId = null, $type = 0)
-	{
-		if ($containerName === '') {
-			throw new Zend_Service_WindowsAzure_Exception('Container name is not specified.');
-		}
-		if (!self::isValidContainerName($containerName)) {
-			throw new Zend_Service_WindowsAzure_Exception('Container name does not adhere to container naming conventions. See http://msdn.microsoft.com/en-us/library/dd135715.aspx for more information.');
-		}
-		if ($blobName === '') {
-			throw new Zend_Service_WindowsAzure_Exception('Blob name is not specified.');
-		}
-		if ($type < 0 || $type > 2) {
-			throw new Zend_Service_WindowsAzure_Exception('Invalid type of block list to retrieve.');
-		}
-
-		// Set $blockListType
-		$blockListType = 'all';
-		if ($type == 1) {
-			$blockListType = 'committed';
-		}
-		if ($type == 2) {
-			$blockListType = 'uncommitted';
-		}
-
-		// Headers
-		$headers = array();
-		if ($leaseId !== null) {
-			$headers['x-ms-lease-id'] = $leaseId;
-		}
-
-		// Build query string
-		$queryString = array('comp=blocklist', 'blocklisttype=' . $blockListType);
-		if ($snapshotId !== null) {
-			$queryString[] = 'snapshot=' . $snapshotId;
-		}
-		$queryString = self::createQueryStringFromArray($queryString);
-
-		// Resource name
-		$resourceName = self::createResourceName($containerName , $blobName);
-			
-		// Perform request
-		$response = $this->_performRequest($resourceName, $queryString, Zend_Http_Client::GET, $headers, false, null, Zend_Service_WindowsAzure_Storage::RESOURCE_BLOB, Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PERMISSION_READ);
-		if ($response->isSuccessful()) {
-			// Parse response
-			$blockList = $this->_parseResponse($response);
-
-			// Create return value
-			$returnValue = array();
-			if ($blockList->CommittedBlocks) {
-				foreach ($blockList->CommittedBlocks->Block as $block) {
-					$returnValue['CommittedBlocks'][] = (object)array(
-			            'Name' => (string)$block->Name,
-			            'Size' => (string)$block->Size
-					);
-				}
-			}
-			if ($blockList->UncommittedBlocks)  {
-				foreach ($blockList->UncommittedBlocks->Block as $block) {
-					$returnValue['UncommittedBlocks'][] = (object)array(
-			            'Name' => (string)$block->Name,
-			            'Size' => (string)$block->Size
-					);
-				}
-			}
-
-			return $returnValue;
-		} else {
-			throw new Zend_Service_WindowsAzure_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
-		}
-	}
-
-	/**
-	 * Create page blob
-	 *
-	 * @param string $containerName      Container name
-	 * @param string $blobName           Blob name
-	 * @param int    $size      		 Size of the page blob in bytes
-	 * @param array  $metadata           Key/value pairs of meta data
-	 * @param string $leaseId            Lease identifier
-	 * @param array  $additionalHeaders  Additional headers. See http://msdn.microsoft.com/en-us/library/dd179371.aspx for more information.
-	 * @return object Partial blob properties
-	 * @throws Zend_Service_WindowsAzure_Exception
-	 */
-	public function createPageBlob($containerName = '', $blobName = '', $size = 0, $metadata = array(), $leaseId = null, $additionalHeaders = array())
-	{
-		if ($containerName === '') {
-			throw new Zend_Service_WindowsAzure_Exception('Container name is not specified.');
-		}
-		if (!self::isValidContainerName($containerName)) {
-			throw new Zend_Service_WindowsAzure_Exception('Container name does not adhere to container naming conventions. See http://msdn.microsoft.com/en-us/library/dd135715.aspx for more information.');
-		}
-		if ($blobName === '') {
-			throw new Zend_Service_WindowsAzure_Exception('Blob name is not specified.');
-		}
-		if ($containerName === '$root' && strpos($blobName, '/') !== false) {
-			throw new Zend_Service_WindowsAzure_Exception('Blobs stored in the root container can not have a name containing a forward slash (/).');
-		}
-		if ($size <= 0) {
-			throw new Zend_Service_WindowsAzure_Exception('Page blob size must be specified.');
-		}
-
-		// Create metadata headers
-		$headers = array();
-		if ($leaseId !== null) {
-			$headers['x-ms-lease-id'] = $leaseId;
-		}
-		$headers = array_merge($headers, $this->_generateMetadataHeaders($metadata));
-
-		// Additional headers?
-		foreach ($additionalHeaders as $key => $value) {
-			$headers[$key] = $value;
-		}
-
-		// Specify blob type & blob length
-		$headers[Zend_Service_WindowsAzure_Storage::PREFIX_STORAGE_HEADER . 'blob-type'] = self::BLOBTYPE_PAGE;
-		$headers[Zend_Service_WindowsAzure_Storage::PREFIX_STORAGE_HEADER . 'blob-content-length'] = $size;
-		$headers['Content-Length'] = 0;
-
-		// Resource name
-		$resourceName = self::createResourceName($containerName , $blobName);
-
-		// Perform request
-		$response = $this->_performRequest($resourceName, '', Zend_Http_Client::PUT, $headers, false, '', Zend_Service_WindowsAzure_Storage::RESOURCE_BLOB, Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PERMISSION_WRITE);
-		if ($response->isSuccessful()) {
-			return new Zend_Service_WindowsAzure_Storage_BlobInstance(
-			$containerName,
-			$blobName,
-			null,
-			$response->getHeader('Etag'),
-			$response->getHeader('Last-modified'),
-			$this->getBaseUrl() . '/' . $containerName . '/' . $blobName,
-			$size,
-				'',
-				'',
-				'',
-			false,
-			$metadata
-			);
-		} else {
-			throw new Zend_Service_WindowsAzure_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
-		}
-	}
-
-	/**
-	 * Put page in page blob
-	 *
-	 * @param string $containerName      Container name
-	 * @param string $blobName           Blob name
-	 * @param int    $startByteOffset    Start byte offset
-	 * @param int    $endByteOffset      End byte offset
-	 * @param mixed  $contents			 Page contents
-	 * @param string $writeMethod        Write method (Zend_Service_WindowsAzure_Storage_Blob::PAGE_WRITE_*)
-	 * @param string $leaseId            Lease identifier
-	 * @param array  $additionalHeaders  Additional headers. See http://msdn.microsoft.com/en-us/library/dd179371.aspx for more information.
-	 * @throws Zend_Service_WindowsAzure_Exception
-	 */
-	public function putPage($containerName = '', $blobName = '', $startByteOffset = 0, $endByteOffset = 0, $contents = '', $writeMethod = self::PAGE_WRITE_UPDATE, $leaseId = null, $additionalHeaders = array())
-	{
-		if ($containerName === '') {
-			throw new Zend_Service_WindowsAzure_Exception('Container name is not specified.');
-		}
-		if (!self::isValidContainerName($containerName)) {
-			throw new Zend_Service_WindowsAzure_Exception('Container name does not adhere to container naming conventions. See http://msdn.microsoft.com/en-us/library/dd135715.aspx for more information.');
-		}
-		if ($blobName === '') {
-			throw new Zend_Service_WindowsAzure_Exception('Blob name is not specified.');
-		}
-		if ($containerName === '$root' && strpos($blobName, '/') !== false) {
-			throw new Zend_Service_WindowsAzure_Exception('Blobs stored in the root container can not have a name containing a forward slash (/).');
-		}
-		if ($startByteOffset % 512 != 0) {
-			throw new Zend_Service_WindowsAzure_Exception('Start byte offset must be a modulus of 512.');
-		}
-		if (($endByteOffset + 1) % 512 != 0) {
-			throw new Zend_Service_WindowsAzure_Exception('End byte offset must be a modulus of 512 minus 1.');
-		}
-
-		// Determine size
-		$size = strlen($contents);
-		if ($size >= self::MAX_BLOB_TRANSFER_SIZE) {
-			throw new Zend_Service_WindowsAzure_Exception('Page blob size must not be larger than ' + self::MAX_BLOB_TRANSFER_SIZE . ' bytes.');
-		}
-
-		// Create metadata headers
-		$headers = array();
-		if ($leaseId !== null) {
-			$headers['x-ms-lease-id'] = $leaseId;
-		}
-
-		// Additional headers?
-		foreach ($additionalHeaders as $key => $value) {
-			$headers[$key] = $value;
-		}
-
-		// Specify range
-		$headers['Range'] = 'bytes=' . $startByteOffset . '-' . $endByteOffset;
-
-		// Write method
-		$headers[Zend_Service_WindowsAzure_Storage::PREFIX_STORAGE_HEADER . 'page-write'] = $writeMethod;
-
-		// Resource name
-		$resourceName = self::createResourceName($containerName , $blobName);
-
-		// Perform request
-		$response = $this->_performRequest($resourceName, '?comp=page', Zend_Http_Client::PUT, $headers, false, $contents, Zend_Service_WindowsAzure_Storage::RESOURCE_BLOB, Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PERMISSION_WRITE);
-		if (!$response->isSuccessful()) {
-			throw new Zend_Service_WindowsAzure_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
-		}
-	}
-
-	/**
-	 * Put page in page blob
-	 *
-	 * @param string $containerName      Container name
-	 * @param string $blobName           Blob name
-	 * @param int    $startByteOffset    Start byte offset
-	 * @param int    $endByteOffset      End byte offset
-	 * @param string $leaseId            Lease identifier
-	 * @return array Array of page ranges
-	 * @throws Zend_Service_WindowsAzure_Exception
-	 */
-	public function getPageRegions($containerName = '', $blobName = '', $startByteOffset = 0, $endByteOffset = 0, $leaseId = null)
-	{
-		if ($containerName === '') {
-			throw new Zend_Service_WindowsAzure_Exception('Container name is not specified.');
-		}
-		if (!self::isValidContainerName($containerName)) {
-			throw new Zend_Service_WindowsAzure_Exception('Container name does not adhere to container naming conventions. See http://msdn.microsoft.com/en-us/library/dd135715.aspx for more information.');
-		}
-		if ($blobName === '') {
-			throw new Zend_Service_WindowsAzure_Exception('Blob name is not specified.');
-		}
-		if ($containerName === '$root' && strpos($blobName, '/') !== false) {
-			throw new Zend_Service_WindowsAzure_Exception('Blobs stored in the root container can not have a name containing a forward slash (/).');
-		}
-		if ($startByteOffset % 512 != 0) {
-			throw new Zend_Service_WindowsAzure_Exception('Start byte offset must be a modulus of 512.');
-		}
-		if ($endByteOffset > 0 && ($endByteOffset + 1) % 512 != 0) {
-			throw new Zend_Service_WindowsAzure_Exception('End byte offset must be a modulus of 512 minus 1.');
-		}
-
-		// Create metadata headers
-		$headers = array();
-		if ($leaseId !== null) {
-			$headers['x-ms-lease-id'] = $leaseId;
-		}
-
-		// Specify range?
-		if ($endByteOffset > 0) {
-			$headers['Range'] = 'bytes=' . $startByteOffset . '-' . $endByteOffset;
-		}
-
-		// Resource name
-		$resourceName = self::createResourceName($containerName , $blobName);
-
-		// Perform request
-		$response = $this->_performRequest($resourceName, '?comp=pagelist', Zend_Http_Client::GET, $headers, false, null, Zend_Service_WindowsAzure_Storage::RESOURCE_BLOB, Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PERMISSION_WRITE);
-		if ($response->isSuccessful()) {
-			$result = $this->_parseResponse($response);
-			$xmlRanges = null;
-			if (count($result->PageRange) > 1) {
-				$xmlRanges = $result->PageRange;
-			} else {
-				$xmlRanges = array($result->PageRange);
-			}
-
-			$ranges = array();
-			for ($i = 0; $i < count($xmlRanges); $i++) {
-				$ranges[] = new Zend_Service_WindowsAzure_Storage_PageRegionInstance(
-				(int)$xmlRanges[$i]->Start,
-				(int)$xmlRanges[$i]->End
-				);
-			}
-			
-			return $ranges;
-		} else {
-			throw new Zend_Service_WindowsAzure_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
-		}
-	}
-		
-	/**
-	 * Copy blob
-	 *
-	 * @param string $sourceContainerName       Source container name
-	 * @param string $sourceBlobName            Source blob name
-	 * @param string $destinationContainerName  Destination container name
-	 * @param string $destinationBlobName       Destination blob name
-	 * @param array  $metadata                  Key/value pairs of meta data
-	 * @param string $sourceSnapshotId          Source snapshot identifier
-	 * @param string $destinationLeaseId        Destination lease identifier
-	 * @param array  $additionalHeaders         Additional headers. See http://msdn.microsoft.com/en-us/library/dd894037.aspx for more information.
-	 * @return object Partial blob properties
-	 * @throws Zend_Service_WindowsAzure_Exception
-	 */
-	public function copyBlob($sourceContainerName = '', $sourceBlobName = '', $destinationContainerName = '', $destinationBlobName = '', $metadata = array(), $sourceSnapshotId = null, $destinationLeaseId = null, $additionalHeaders = array())
-	{
-		if ($sourceContainerName === '') {
-			throw new Zend_Service_WindowsAzure_Exception('Source container name is not specified.');
-		}
-		if (!self::isValidContainerName($sourceContainerName)) {
-			throw new Zend_Service_WindowsAzure_Exception('Source container name does not adhere to container naming conventions. See http://msdn.microsoft.com/en-us/library/dd135715.aspx for more information.');
-		}
-		if ($sourceBlobName === '') {
-			throw new Zend_Service_WindowsAzure_Exception('Source blob name is not specified.');
-		}
-		if ($destinationContainerName === '') {
-			throw new Zend_Service_WindowsAzure_Exception('Destination container name is not specified.');
-		}
-		if (!self::isValidContainerName($destinationContainerName)) {
-			throw new Zend_Service_WindowsAzure_Exception('Destination container name does not adhere to container naming conventions. See http://msdn.microsoft.com/en-us/library/dd135715.aspx for more information.');
-		}
-		if ($destinationBlobName === '') {
-			throw new Zend_Service_WindowsAzure_Exception('Destination blob name is not specified.');
-		}
-		if ($sourceContainerName === '$root' && strpos($sourceBlobName, '/') !== false) {
-			throw new Zend_Service_WindowsAzure_Exception('Blobs stored in the root container can not have a name containing a forward slash (/).');
-		}
-		if ($destinationContainerName === '$root' && strpos($destinationBlobName, '/') !== false) {
-			throw new Zend_Service_WindowsAzure_Exception('Blobs stored in the root container can not have a name containing a forward slash (/).');
-		}
-
-		// Create metadata headers
-		$headers = array();
-		if ($destinationLeaseId !== null) {
-			$headers['x-ms-lease-id'] = $destinationLeaseId;
-		}
-		$headers = array_merge($headers, $this->_generateMetadataHeaders($metadata));
-
-		// Additional headers?
-		foreach ($additionalHeaders as $key => $value) {
-			$headers[$key] = $value;
-		}
-
-		// Resource names
-		$sourceResourceName = self::createResourceName($sourceContainerName, $sourceBlobName);
-		if ($sourceSnapshotId !== null) {
-			$sourceResourceName .= '?snapshot=' . $sourceSnapshotId;
-		}
-		$destinationResourceName = self::createResourceName($destinationContainerName, $destinationBlobName);
-
-		// Set source blob
-		$headers["x-ms-copy-source"] = '/' . $this->_accountName . '/' . $sourceResourceName;
-
-		// Perform request
-		$response = $this->_performRequest($destinationResourceName, '', Zend_Http_Client::PUT, $headers, false, null, Zend_Service_WindowsAzure_Storage::RESOURCE_BLOB, Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PERMISSION_WRITE);
-		if ($response->isSuccessful()) {
-			return new Zend_Service_WindowsAzure_Storage_BlobInstance(
-			$destinationContainerName,
-			$destinationBlobName,
-			null,
-			$response->getHeader('Etag'),
-			$response->getHeader('Last-modified'),
-			$this->getBaseUrl() . '/' . $destinationContainerName . '/' . $destinationBlobName,
-			0,
-				'',
-				'',
-				'',
-			false,
-			$metadata
-			);
-		} else {
-			throw new Zend_Service_WindowsAzure_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
-		}
-	}
-
-	/**
-	 * Get blob
-	 *
-	 * @param string $containerName      Container name
-	 * @param string $blobName           Blob name
-	 * @param string $localFileName      Local file name to store downloaded blob
-	 * @param string $snapshotId         Snapshot identifier
-	 * @param string $leaseId            Lease identifier
-	 * @param array  $additionalHeaders  Additional headers. See http://msdn.microsoft.com/en-us/library/dd179371.aspx for more information.
-	 * @throws Zend_Service_WindowsAzure_Exception
-	 */
-	public function getBlob($containerName = '', $blobName = '', $localFileName = '', $snapshotId = null, $leaseId = null, $additionalHeaders = array())
-	{
-		if ($containerName === '') {
-			throw new Zend_Service_WindowsAzure_Exception('Container name is not specified.');
-		}
-		if (!self::isValidContainerName($containerName)) {
-			throw new Zend_Service_WindowsAzure_Exception('Container name does not adhere to container naming conventions. See http://msdn.microsoft.com/en-us/library/dd135715.aspx for more information.');
-		}
-		if ($blobName === '') {
-			throw new Zend_Service_WindowsAzure_Exception('Blob name is not specified.');
-		}
-		if ($localFileName === '') {
-			throw new Zend_Service_WindowsAzure_Exception('Local file name is not specified.');
-		}
-
-		// Fetch data
-		file_put_contents($localFileName, $this->getBlobData($containerName, $blobName, $snapshotId, $leaseId, $additionalHeaders));
-	}
-
-	/**
-	 * Get blob data
-	 *
-	 * @param string $containerName      Container name
-	 * @param string $blobName           Blob name
-	 * @param string $snapshotId         Snapshot identifier
-	 * @param string $leaseId            Lease identifier
-	 * @param array  $additionalHeaders  Additional headers. See http://msdn.microsoft.com/en-us/library/dd179371.aspx for more information.
-	 * @return mixed Blob contents
-	 * @throws Zend_Service_WindowsAzure_Exception
-	 */
-	public function getBlobData($containerName = '', $blobName = '', $snapshotId = null, $leaseId = null, $additionalHeaders = array())
-	{
-		if ($containerName === '') {
-			throw new Zend_Service_WindowsAzure_Exception('Container name is not specified.');
-		}
-		if (!self::isValidContainerName($containerName)) {
-			throw new Zend_Service_WindowsAzure_Exception('Container name does not adhere to container naming conventions. See http://msdn.microsoft.com/en-us/library/dd135715.aspx for more information.');
-		}
-		if ($blobName === '') {
-			throw new Zend_Service_WindowsAzure_Exception('Blob name is not specified.');
-		}
-
-		// Build query string
-		$queryString = array();
-		if ($snapshotId !== null) {
-			$queryString[] = 'snapshot=' . $snapshotId;
-		}
-		$queryString = self::createQueryStringFromArray($queryString);
-
-		// Additional headers?
-		$headers = array();
-		if ($leaseId !== null) {
-			$headers['x-ms-lease-id'] = $leaseId;
-		}
-		foreach ($additionalHeaders as $key => $value) {
-			$headers[$key] = $value;
-		}
-
-		// Resource name
-		$resourceName = self::createResourceName($containerName , $blobName);
-
-		// Perform request
-		$response = $this->_performRequest($resourceName, $queryString, Zend_Http_Client::GET, $headers, false, null, Zend_Service_WindowsAzure_Storage::RESOURCE_BLOB, Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PERMISSION_READ);
-		if ($response->isSuccessful()) {
-			return $response->getBody();
-		} else {
-			throw new Zend_Service_WindowsAzure_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
-		}
-	}
-
-	/**
-	 * Get blob instance
-	 *
-	 * @param string $containerName      Container name
-	 * @param string $blobName           Blob name
-	 * @param string $snapshotId         Snapshot identifier
-	 * @param string $leaseId            Lease identifier
-	 * @param array  $additionalHeaders  Additional headers. See http://msdn.microsoft.com/en-us/library/dd179371.aspx for more information.
-	 * @return Zend_Service_WindowsAzure_Storage_BlobInstance
-	 * @throws Zend_Service_WindowsAzure_Exception
-	 */
-	public function getBlobInstance($containerName = '', $blobName = '', $snapshotId = null, $leaseId = null, $additionalHeaders = array())
-	{
-		if ($containerName === '') {
-			throw new Zend_Service_WindowsAzure_Exception('Container name is not specified.');
-		}
-		if (!self::isValidContainerName($containerName)) {
-			throw new Zend_Service_WindowsAzure_Exception('Container name does not adhere to container naming conventions. See http://msdn.microsoft.com/en-us/library/dd135715.aspx for more information.');
-		}
-		if ($blobName === '') {
-			throw new Zend_Service_WindowsAzure_Exception('Blob name is not specified.');
-		}
-		if ($containerName === '$root' && strpos($blobName, '/') !== false) {
-			throw new Zend_Service_WindowsAzure_Exception('Blobs stored in the root container can not have a name containing a forward slash (/).');
-		}
-
-		// Build query string
-		$queryString = array();
-		if ($snapshotId !== null) {
-			$queryString[] = 'snapshot=' . $snapshotId;
-		}
-		$queryString = self::createQueryStringFromArray($queryString);
-		
-		// Additional headers?
-		$headers = array();
-		if ($leaseId !== null) {
-			$headers['x-ms-lease-id'] = $leaseId;
-		}
-		foreach ($additionalHeaders as $key => $value) {
-			$headers[$key] = $value;
-		}
-
-		// Resource name
-		$resourceName = self::createResourceName($containerName , $blobName);
-
-		// Perform request
-		$response = $this->_performRequest($resourceName, $queryString, Zend_Http_Client::HEAD, $headers, false, null, Zend_Service_WindowsAzure_Storage::RESOURCE_BLOB, Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PERMISSION_READ);
-		if ($response->isSuccessful()) {
-			// Parse metadata
-			$metadata = $this->_parseMetadataHeaders($response->getHeaders());
-
-			// Return blob
-			return new Zend_Service_WindowsAzure_Storage_BlobInstance(
-			$containerName,
-			$blobName,
-			$snapshotId,
-			$response->getHeader('Etag'),
-			$response->getHeader('Last-modified'),
-			$this->getBaseUrl() . '/' . $containerName . '/' . $blobName,
-			$response->getHeader('Content-Length'),
-			$response->getHeader('Content-Type'),
-			$response->getHeader('Content-Encoding'),
-			$response->getHeader('Content-Language'),
-			$response->getHeader('Cache-Control'),
-			$response->getHeader('x-ms-blob-type'),
-			$response->getHeader('x-ms-lease-status'),
-			false,
-			$metadata
-			);
-		} else {
-			throw new Zend_Service_WindowsAzure_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
-		}
-	}
-
-	/**
-	 * Get blob metadata
-	 *
-	 * @param string $containerName  Container name
-	 * @param string $blobName       Blob name
-	 * @param string $snapshotId     Snapshot identifier
-	 * @param string $leaseId        Lease identifier
-	 * @return array Key/value pairs of meta data
-	 * @throws Zend_Service_WindowsAzure_Exception
-	 */
-	public function getBlobMetadata($containerName = '', $blobName = '', $snapshotId = null, $leaseId = null)
-	{
-		if ($containerName === '') {
-			throw new Zend_Service_WindowsAzure_Exception('Container name is not specified.');
-		}
-		if (!self::isValidContainerName($containerName)) {
-			throw new Zend_Service_WindowsAzure_Exception('Container name does not adhere to container naming conventions. See http://msdn.microsoft.com/en-us/library/dd135715.aspx for more information.');
-		}
-		if ($blobName === '') {
-			throw new Zend_Service_WindowsAzure_Exception('Blob name is not specified.');
-		}
-		if ($containerName === '$root' && strpos($blobName, '/') !== false) {
-			throw new Zend_Service_WindowsAzure_Exception('Blobs stored in the root container can not have a name containing a forward slash (/).');
-		}
-
-		return $this->getBlobInstance($containerName, $blobName, $snapshotId, $leaseId)->Metadata;
-	}
-
-	/**
-	 * Set blob metadata
-	 *
-	 * Calling the Set Blob Metadata operation overwrites all existing metadata that is associated with the blob. It's not possible to modify an individual name/value pair.
-	 *
-	 * @param string $containerName      Container name
-	 * @param string $blobName           Blob name
-	 * @param array  $metadata           Key/value pairs of meta data
-	 * @param string $leaseId            Lease identifier
-	 * @param array  $additionalHeaders  Additional headers. See http://msdn.microsoft.com/en-us/library/dd179371.aspx for more information.
-	 * @throws Zend_Service_WindowsAzure_Exception
-	 */
-	public function setBlobMetadata($containerName = '', $blobName = '', $metadata = array(), $leaseId = null, $additionalHeaders = array())
-	{
-		if ($containerName === '') {
-			throw new Zend_Service_WindowsAzure_Exception('Container name is not specified.');
-		}
-		if (!self::isValidContainerName($containerName)) {
-			throw new Zend_Service_WindowsAzure_Exception('Container name does not adhere to container naming conventions. See http://msdn.microsoft.com/en-us/library/dd135715.aspx for more information.');
-		}
-		if ($blobName === '') {
-			throw new Zend_Service_WindowsAzure_Exception('Blob name is not specified.');
-		}
-		if ($containerName === '$root' && strpos($blobName, '/') !== false) {
-			throw new Zend_Service_WindowsAzure_Exception('Blobs stored in the root container can not have a name containing a forward slash (/).');
-		}
-		if (count($metadata) == 0) {
-			return;
-		}
-
-		// Create metadata headers
-		$headers = array();
-		if ($leaseId !== null) {
-			$headers['x-ms-lease-id'] = $leaseId;
-		}
-		$headers = array_merge($headers, $this->_generateMetadataHeaders($metadata));
-
-		// Additional headers?
-		foreach ($additionalHeaders as $key => $value) {
-			$headers[$key] = $value;
-		}
-
-		// Perform request
-		$response = $this->_performRequest($containerName . '/' . $blobName, '?comp=metadata', Zend_Http_Client::PUT, $headers, false, null, Zend_Service_WindowsAzure_Storage::RESOURCE_BLOB, Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PERMISSION_WRITE);
-		if (!$response->isSuccessful()) {
-			throw new Zend_Service_WindowsAzure_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
-		}
-	}
-
-	/**
-	 * Set blob properties
-	 *
-	 * All available properties are listed at http://msdn.microsoft.com/en-us/library/ee691966.aspx and should be provided in the $additionalHeaders parameter.
-	 *
-	 * @param string $containerName      Container name
-	 * @param string $blobName           Blob name
-	 * @param string $leaseId            Lease identifier
-	 * @param array  $additionalHeaders  Additional headers. See http://msdn.microsoft.com/en-us/library/dd179371.aspx for more information.
-	 * @throws Zend_Service_WindowsAzure_Exception
-	 */
-	public function setBlobProperties($containerName = '', $blobName = '', $leaseId = null, $additionalHeaders = array())
-	{
-		if ($containerName === '') {
-			throw new Zend_Service_WindowsAzure_Exception('Container name is not specified.');
-		}
-		if (!self::isValidContainerName($containerName)) {
-			throw new Zend_Service_WindowsAzure_Exception('Container name does not adhere to container naming conventions. See http://msdn.microsoft.com/en-us/library/dd135715.aspx for more information.');
-		}
-		if ($blobName === '') {
-			throw new Zend_Service_WindowsAzure_Exception('Blob name is not specified.');
-		}
-		if ($containerName === '$root' && strpos($blobName, '/') !== false) {
-			throw new Zend_Service_WindowsAzure_Exception('Blobs stored in the root container can not have a name containing a forward slash (/).');
-		}
-		if (count($additionalHeaders) == 0) {
-			throw new Zend_Service_WindowsAzure_Exception('No additional headers are specified.');
-		}
-
-		// Create headers
-		$headers = array();
-
-		// Lease set?
-		if ($leaseId !== null) {
-			$headers['x-ms-lease-id'] = $leaseId;
-		}
-
-		// Additional headers?
-		foreach ($additionalHeaders as $key => $value) {
-			$headers[$key] = $value;
-		}
-
-		// Perform request
-		$response = $this->_performRequest($containerName . '/' . $blobName, '?comp=properties', Zend_Http_Client::PUT, $headers, false, null, Zend_Service_WindowsAzure_Storage::RESOURCE_BLOB, Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PERMISSION_WRITE);
-		if (!$response->isSuccessful()) {
-			throw new Zend_Service_WindowsAzure_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
-		}
-	}
-
-	/**
-	 * Get blob properties
-	 *
-	 * @param string $containerName      Container name
-	 * @param string $blobName           Blob name
-	 * @param string $snapshotId         Snapshot identifier
-	 * @param string $leaseId            Lease identifier
-	 * @return Zend_Service_WindowsAzure_Storage_BlobInstance
-	 * @throws Zend_Service_WindowsAzure_Exception
-	 */
-	public function getBlobProperties($containerName = '', $blobName = '', $snapshotId = null, $leaseId = null)
-	{
-		if ($containerName === '') {
-			throw new Zend_Service_WindowsAzure_Exception('Container name is not specified.');
-		}
-		if (!self::isValidContainerName($containerName)) {
-			throw new Zend_Service_WindowsAzure_Exception('Container name does not adhere to container naming conventions. See http://msdn.microsoft.com/en-us/library/dd135715.aspx for more information.');
-		}
-		if ($blobName === '') {
-			throw new Zend_Service_WindowsAzure_Exception('Blob name is not specified.');
-		}
-		if ($containerName === '$root' && strpos($blobName, '/') !== false) {
-			throw new Zend_Service_WindowsAzure_Exception('Blobs stored in the root container can not have a name containing a forward slash (/).');
-		}
-
-		return $this->getBlobInstance($containerName, $blobName, $snapshotId, $leaseId);
-	}
-
-	/**
-	 * Delete blob
-	 *
-	 * @param string $containerName      Container name
-	 * @param string $blobName           Blob name
-	 * @param string $snapshotId         Snapshot identifier
-	 * @param string $leaseId            Lease identifier
-	 * @param array  $additionalHeaders  Additional headers. See http://msdn.microsoft.com/en-us/library/dd179371.aspx for more information.
-	 * @throws Zend_Service_WindowsAzure_Exception
-	 */
-	public function deleteBlob($containerName = '', $blobName = '', $snapshotId = null, $leaseId = null, $additionalHeaders = array())
-	{
-		if ($containerName === '') {
-			throw new Zend_Service_WindowsAzure_Exception('Container name is not specified.');
-		}
-		if (!self::isValidContainerName($containerName)) {
-			throw new Zend_Service_WindowsAzure_Exception('Container name does not adhere to container naming conventions. See http://msdn.microsoft.com/en-us/library/dd135715.aspx for more information.');
-		}
-		if ($blobName === '') {
-			throw new Zend_Service_WindowsAzure_Exception('Blob name is not specified.');
-		}
-		if ($containerName === '$root' && strpos($blobName, '/') !== false) {
-			throw new Zend_Service_WindowsAzure_Exception('Blobs stored in the root container can not have a name containing a forward slash (/).');
-		}
-
-		// Build query string
-		$queryString = array();
-		if ($snapshotId !== null) {
-			$queryString[] = 'snapshot=' . $snapshotId;
-		}
-		$queryString = self::createQueryStringFromArray($queryString);
-			
-		// Additional headers?
-		$headers = array();
-		if ($leaseId !== null) {
-			$headers['x-ms-lease-id'] = $leaseId;
-		}
-		foreach ($additionalHeaders as $key => $value) {
-			$headers[$key] = $value;
-		}
-
-		// Resource name
-		$resourceName = self::createResourceName($containerName , $blobName);
-
-		// Perform request
-		$response = $this->_performRequest($resourceName, $queryString, Zend_Http_Client::DELETE, $headers, false, null, Zend_Service_WindowsAzure_Storage::RESOURCE_BLOB, Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PERMISSION_WRITE);
-		if (!$response->isSuccessful()) {
-			throw new Zend_Service_WindowsAzure_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
-		}
-	}
-
-	/**
-	 * Snapshot blob
-	 *
-	 * @param string $containerName      Container name
-	 * @param string $blobName           Blob name
-	 * @param array  $metadata           Key/value pairs of meta data
-	 * @param array  $additionalHeaders  Additional headers. See http://msdn.microsoft.com/en-us/library/dd179371.aspx for more information.
-	 * @return string Date/Time value representing the snapshot identifier.
-	 * @throws Zend_Service_WindowsAzure_Exception
-	 */
-	public function snapshotBlob($containerName = '', $blobName = '', $metadata = array(), $additionalHeaders = array())
-	{
-		if ($containerName === '') {
-			throw new Zend_Service_WindowsAzure_Exception('Container name is not specified.');
-		}
-		if (!self::isValidContainerName($containerName)) {
-			throw new Zend_Service_WindowsAzure_Exception('Container name does not adhere to container naming conventions. See http://msdn.microsoft.com/en-us/library/dd135715.aspx for more information.');
-		}
-		if ($blobName === '') {
-			throw new Zend_Service_WindowsAzure_Exception('Blob name is not specified.');
-		}
-		if ($containerName === '$root' && strpos($blobName, '/') !== false) {
-			throw new Zend_Service_WindowsAzure_Exception('Blobs stored in the root container can not have a name containing a forward slash (/).');
-		}
-
-		// Additional headers?
-		$headers = array();
-		foreach ($additionalHeaders as $key => $value) {
-			$headers[$key] = $value;
-		}
-
-		// Resource name
-		$resourceName = self::createResourceName($containerName , $blobName);
-
-		// Perform request
-		$response = $this->_performRequest($resourceName, '?comp=snapshot', Zend_Http_Client::PUT, $headers, false, null, Zend_Service_WindowsAzure_Storage::RESOURCE_BLOB, Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PERMISSION_WRITE);
-		if ($response->isSuccessful()) {
-			return $response->getHeader('x-ms-snapshot');
-		} else {
-			throw new Zend_Service_WindowsAzure_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
-		}
-	}
-
-	/**
-	 * Lease blob - See (http://msdn.microsoft.com/en-us/library/ee691972.aspx)
-	 *
-	 * @param string $containerName      Container name
-	 * @param string $blobName           Blob name
-	 * @param string $leaseAction        Lease action (Zend_Service_WindowsAzure_Storage_Blob::LEASE_*)
-	 * @param string $leaseId            Lease identifier, required to renew the lease or to release the lease.
-	 * @return Zend_Service_WindowsAzure_Storage_LeaseInstance Lease instance
-	 * @throws Zend_Service_WindowsAzure_Exception
-	 */
-	public function leaseBlob($containerName = '', $blobName = '', $leaseAction = self::LEASE_ACQUIRE, $leaseId = null)
-	{
-		if ($containerName === '') {
-			throw new Zend_Service_WindowsAzure_Exception('Container name is not specified.');
-		}
-		if (!self::isValidContainerName($containerName)) {
-			throw new Zend_Service_WindowsAzure_Exception('Container name does not adhere to container naming conventions. See http://msdn.microsoft.com/en-us/library/dd135715.aspx for more information.');
-		}
-		if ($blobName === '') {
-			throw new Zend_Service_WindowsAzure_Exception('Blob name is not specified.');
-		}
-		if ($containerName === '$root' && strpos($blobName, '/') !== false) {
-			throw new Zend_Service_WindowsAzure_Exception('Blobs stored in the root container can not have a name containing a forward slash (/).');
-		}
-
-		// Additional headers?
-		$headers = array();
-		$headers['x-ms-lease-action'] = strtolower($leaseAction);
-		if ($leaseId !== null) {
-			$headers['x-ms-lease-id'] = $leaseId;
-		}
-
-		// Resource name
-		$resourceName = self::createResourceName($containerName , $blobName);
-
-		// Perform request
-		$response = $this->_performRequest($resourceName, '?comp=lease', Zend_Http_Client::PUT, $headers, false, null, Zend_Service_WindowsAzure_Storage::RESOURCE_BLOB, Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PERMISSION_WRITE);
-		if ($response->isSuccessful()) {
-			return new Zend_Service_WindowsAzure_Storage_LeaseInstance(
-			$containerName,
-			$blobName,
-			$response->getHeader('x-ms-lease-id'),
-			$response->getHeader('x-ms-lease-time'));
-		} else {
-			throw new Zend_Service_WindowsAzure_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
-		}
-	}
-
-	/**
-	 * List blobs
-	 *
-	 * @param string $containerName Container name
-	 * @param string $prefix     Optional. Filters the results to return only blobs whose name begins with the specified prefix.
-	 * @param string $delimiter  Optional. Delimiter, i.e. '/', for specifying folder hierarchy
-	 * @param int    $maxResults Optional. Specifies the maximum number of blobs to return per call to Azure storage. This does NOT affect list size returned by this function. (maximum: 5000)
-	 * @param string $marker     Optional string value that identifies the portion of the list to be returned with the next list operation.
-	 * @param string $include    Optional. Specifies that the response should include one or more of the following subsets: '', 'metadata', 'snapshots', 'uncommittedblobs'). Multiple values can be added separated with a comma (,)
-	 * @param int    $currentResultCount Current result count (internal use)
-	 * @return array
-	 * @throws Zend_Service_WindowsAzure_Exception
-	 */
-	public function listBlobs($containerName = '', $prefix = '', $delimiter = '', $maxResults = null, $marker = null, $include = null, $currentResultCount = 0)
-	{
-		if ($containerName === '') {
-			throw new Zend_Service_WindowsAzure_Exception('Container name is not specified.');
-		}
-		if (!self::isValidContainerName($containerName)) {
-			throw new Zend_Service_WindowsAzure_Exception('Container name does not adhere to container naming conventions. See http://msdn.microsoft.com/en-us/library/dd135715.aspx for more information.');
-		}
-			
-		// Build query string
-		$queryString = array('restype=container', 'comp=list');
-		if ($prefix !== null) {
-			$queryString[] = 'prefix=' . $prefix;
-		}
-		if ($delimiter !== '') {
-			$queryString[] = 'delimiter=' . $delimiter;
-		}
-		if ($maxResults !== null) {
-			$queryString[] = 'maxresults=' . $maxResults;
-		}
-		if ($marker !== null) {
-			$queryString[] = 'marker=' . $marker;
-		}
-		if ($include !== null) {
-			$queryString[] = 'include=' . $include;
-		}
-		$queryString = self::createQueryStringFromArray($queryString);
-
-		// Perform request
-		$response = $this->_performRequest($containerName, $queryString, Zend_Http_Client::GET, array(), false, null, Zend_Service_WindowsAzure_Storage::RESOURCE_BLOB, Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PERMISSION_LIST);
-		if ($response->isSuccessful()) {
-			// Return value
-			$blobs = array();
-
-			// Blobs
-			$xmlBlobs = $this->_parseResponse($response)->Blobs->Blob;
-			if ($xmlBlobs !== null) {
-				for ($i = 0; $i < count($xmlBlobs); $i++) {
-					$properties = (array)$xmlBlobs[$i]->Properties;
-						
-					$blobs[] = new Zend_Service_WindowsAzure_Storage_BlobInstance(
-					$containerName,
-					(string)$xmlBlobs[$i]->Name,
-					(string)$xmlBlobs[$i]->Snapshot,
-					(string)$properties['Etag'],
-					(string)$properties['Last-Modified'],
-					(string)$xmlBlobs[$i]->Url,
-					(string)$properties['Content-Length'],
-					(string)$properties['Content-Type'],
-					(string)$properties['Content-Encoding'],
-					(string)$properties['Content-Language'],
-					(string)$properties['Cache-Control'],
-					(string)$properties['BlobType'],
-					(string)$properties['LeaseStatus'],
-					false,
-					$this->_parseMetadataElement($xmlBlobs[$i])
-					);
-				}
-			}
-				
-			// Blob prefixes (folders)
-			$xmlBlobs = $this->_parseResponse($response)->Blobs->BlobPrefix;
-				
-			if ($xmlBlobs !== null) {
-				for ($i = 0; $i < count($xmlBlobs); $i++) {
-					$blobs[] = new Zend_Service_WindowsAzure_Storage_BlobInstance(
-					$containerName,
-					(string)$xmlBlobs[$i]->Name,
-					null,
-						'',
-						'',
-						'',
-					0,
-						'',
-						'',
-						'',
-						'',
-						'',
-						'',
-					true,
-					$this->_parseMetadataElement($xmlBlobs[$i])
-					);
-				}
-			}
-				
-			// More blobs?
-			$xmlMarker = (string)$this->_parseResponse($response)->NextMarker;
-			$currentResultCount = $currentResultCount + count($blobs);
-			if ($maxResults !== null && $currentResultCount < $maxResults) {
-				if ($xmlMarker !== null && $xmlMarker != '') {
-					$blobs = array_merge($blobs, $this->listBlobs($containerName, $prefix, $delimiter, $maxResults, $marker, $include, $currentResultCount));
-				}
-			}
-			if ($maxResults !== null && count($blobs) > $maxResults) {
-				$blobs = array_slice($blobs, 0, $maxResults);
-			}
-				
-			return $blobs;
-		} else {
-			throw new Zend_Service_WindowsAzure_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
-		}
-	}
-
-	/**
-	 * Generate shared access URL
-	 *
-	 * @param string $containerName  Container name
-	 * @param string $blobName       Blob name
-	 * @param string $resource       Signed resource - container (c) - blob (b)
-	 * @param string $permissions    Signed permissions - read (r), write (w), delete (d) and list (l)
-	 * @param string $start          The time at which the Shared Access Signature becomes valid.
-	 * @param string $expiry         The time at which the Shared Access Signature becomes invalid.
-	 * @param string $identifier     Signed identifier
-	 * @return string
-	 */
-	public function generateSharedAccessUrl($containerName = '', $blobName = '', $resource = 'b', $permissions = 'r', $start = '', $expiry = '', $identifier = '')
-	{
-		if ($containerName === '') {
-			throw new Zend_Service_WindowsAzure_Exception('Container name is not specified.');
-		}
-		if (!self::isValidContainerName($containerName)) {
-			throw new Zend_Service_WindowsAzure_Exception('Container name does not adhere to container naming conventions. See http://msdn.microsoft.com/en-us/library/dd135715.aspx for more information.');
-		}
-
-		// Resource name
-		$resourceName = self::createResourceName($containerName , $blobName);
-
-		// Generate URL
-		return $this->getBaseUrl() . '/' . $resourceName . '?' .
-		$this->_sharedAccessSignatureCredentials->createSignedQueryString(
-		$resourceName,
-		        '',
-		$resource,
-		$permissions,
-		$start,
-		$expiry,
-		$identifier);
-	}
-
-	/**
-	 * Register this object as stream wrapper client
-	 *
-	 * @param  string $name Protocol name
-	 * @return Zend_Service_WindowsAzure_Storage_Blob
-	 */
-	public function registerAsClient($name)
-	{
-		self::$_wrapperClients[$name] = $this;
-		return $this;
-	}
-
-	/**
-	 * Unregister this object as stream wrapper client
-	 *
-	 * @param  string $name Protocol name
-	 * @return Zend_Service_WindowsAzure_Storage_Blob
-	 */
-	public function unregisterAsClient($name)
-	{
-		unset(self::$_wrapperClients[$name]);
-		return $this;
-	}
-
-	/**
-	 * Get wrapper client for stream type
-	 *
-	 * @param  string $name Protocol name
-	 * @return Zend_Service_WindowsAzure_Storage_Blob
-	 */
-	public static function getWrapperClient($name)
-	{
-		return self::$_wrapperClients[$name];
-	}
-
-	/**
-	 * Register this object as stream wrapper
-	 *
-	 * @param  string $name Protocol name
-	 */
-	public function registerStreamWrapper($name = 'azure')
-	{
-		/**
-		 * @see Zend_Service_WindowsAzure_Storage_Blob_Stream
-		 */
-		require_once 'Zend/Service/WindowsAzure/Storage/Blob/Stream.php';
-
-		stream_register_wrapper($name, 'Zend_Service_WindowsAzure_Storage_Blob_Stream');
-		$this->registerAsClient($name);
-	}
-
-	/**
-	 * Unregister this object as stream wrapper
-	 *
-	 * @param  string $name Protocol name
-	 * @return Zend_Service_WindowsAzure_Storage_Blob
-	 */
-	public function unregisterStreamWrapper($name = 'azure')
-	{
-		stream_wrapper_unregister($name);
-		$this->unregisterAsClient($name);
-	}
-
-	/**
-	 * Create resource name
-	 *
-	 * @param string $containerName  Container name
-	 * @param string $blobName Blob name
-	 * @return string
-	 */
-	public static function createResourceName($containerName = '', $blobName = '')
-	{
-		// Resource name
-		$resourceName = $containerName . '/' . $blobName;
-		if ($containerName === '' || $containerName === '$root') {
-			$resourceName = $blobName;
-		}
-		if ($blobName === '') {
-			$resourceName = $containerName;
-		}
-
-		return $resourceName;
-	}
-
-	/**
-	 * Is valid container name?
-	 *
-	 * @param string $containerName Container name
-	 * @return boolean
-	 */
-	public static function isValidContainerName($containerName = '')
-	{
-		if ($containerName == '$root') {
-			return true;
-		}
-
-		if (preg_match("/^[a-z0-9][a-z0-9-]*$/", $containerName) === 0) {
-			return false;
-		}
-
-		if (strpos($containerName, '--') !== false) {
-			return false;
-		}
-
-		if (strtolower($containerName) != $containerName) {
-			return false;
-		}
-
-		if (strlen($containerName) < 3 || strlen($containerName) > 63) {
-			return false;
-		}
-
-		if (substr($containerName, -1) == '-') {
-			return false;
-		}
-
-		return true;
-	}
-
-	/**
-	 * Get error message from Zend_Http_Response
-	 *
-	 * @param Zend_Http_Response $response Repsonse
-	 * @param string $alternativeError Alternative error message
-	 * @return string
-	 */
-	protected function _getErrorMessage(Zend_Http_Response $response, $alternativeError = 'Unknown error.')
-	{
-		$response = $this->_parseResponse($response);
-		if ($response && $response->Message) {
-			return (string)$response->Message;
-		} else {
-			return $alternativeError;
-		}
-	}
-
-	/**
-	 * Generate block id
-	 *
-	 * @param int $part Block number
-	 * @return string Windows Azure Blob Storage block number
-	 */
-	protected function _generateBlockId($part = 0)
-	{
-		$returnValue = $part;
-		while (strlen($returnValue) < 64) {
-			$returnValue = '0' . $returnValue;
-		}
-
-		return $returnValue;
-	}
+    /**
+     * ACL - Private access
+     */
+    const ACL_PRIVATE = null;
+
+    /**
+     * ACL - Public access (read all blobs)
+     *
+     * @deprecated Use ACL_PUBLIC_CONTAINER or ACL_PUBLIC_BLOB instead.
+     */
+    const ACL_PUBLIC = 'container';
+    
+    /**
+     * ACL - Blob Public access (read all blobs)
+     */
+    const ACL_PUBLIC_BLOB = 'blob';
+
+    /**
+     * ACL - Container Public access (enumerate and read all blobs)
+     */
+    const ACL_PUBLIC_CONTAINER = 'container';
+
+    /**
+     * Blob lease constants
+     */
+    const LEASE_ACQUIRE = 'acquire';
+    const LEASE_RENEW   = 'renew';
+    const LEASE_RELEASE = 'release';
+    const LEASE_BREAK   = 'break';
+
+    /**
+     * Maximal blob size (in bytes)
+     */
+    const MAX_BLOB_SIZE = 67108864;
+
+    /**
+     * Maximal blob transfer size (in bytes)
+     */
+    const MAX_BLOB_TRANSFER_SIZE = 4194304;
+
+    /**
+     * Blob types
+     */
+    const BLOBTYPE_BLOCK = 'BlockBlob';
+    const BLOBTYPE_PAGE  = 'PageBlob';
+
+    /**
+     * Put page write options
+     */
+    const PAGE_WRITE_UPDATE = 'update';
+    const PAGE_WRITE_CLEAR  = 'clear';
+
+    /**
+     * Stream wrapper clients
+     *
+     * @var array
+     */
+    protected static $_wrapperClients = array();
+
+    /**
+     * SharedAccessSignature credentials
+     *
+     * @var Zend_Service_WindowsAzure_Credentials_SharedAccessSignature
+     */
+    private $_sharedAccessSignatureCredentials = null;
+
+    /**
+     * Creates a new Zend_Service_WindowsAzure_Storage_Blob instance
+     *
+     * @param string $host Storage host name
+     * @param string $accountName Account name for Windows Azure
+     * @param string $accountKey Account key for Windows Azure
+     * @param boolean $usePathStyleUri Use path-style URI's
+     * @param Zend_Service_WindowsAzure_RetryPolicy_RetryPolicyAbstract $retryPolicy Retry policy to use when making requests
+     */
+    public function __construct($host = Zend_Service_WindowsAzure_Storage::URL_DEV_BLOB, $accountName = Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::DEVSTORE_ACCOUNT, $accountKey = Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::DEVSTORE_KEY, $usePathStyleUri = false, Zend_Service_WindowsAzure_RetryPolicy_RetryPolicyAbstract $retryPolicy = null)
+    {
+        parent::__construct($host, $accountName, $accountKey, $usePathStyleUri, $retryPolicy);
+
+        // API version
+        $this->_apiVersion = '2009-09-19';
+
+        // SharedAccessSignature credentials
+        $this->_sharedAccessSignatureCredentials = new Zend_Service_WindowsAzure_Credentials_SharedAccessSignature($accountName, $accountKey, $usePathStyleUri);
+    }
+
+    /**
+     * Check if a blob exists
+     *
+     * @param string $containerName Container name
+     * @param string $blobName      Blob name
+     * @param string $snapshotId    Snapshot identifier
+     * @return boolean
+     */
+    public function blobExists($containerName = '', $blobName = '', $snapshotId = null)
+    {
+        if ($containerName === '') {
+            throw new Zend_Service_WindowsAzure_Exception('Container name is not specified.');
+        }
+        if (!self::isValidContainerName($containerName)) {
+            throw new Zend_Service_WindowsAzure_Exception('Container name does not adhere to container naming conventions. See http://msdn.microsoft.com/en-us/library/dd135715.aspx for more information.');
+        }
+        if ($blobName === '') {
+            throw new Zend_Service_WindowsAzure_Exception('Blob name is not specified.');
+        }
+
+        // Get blob instance
+        try {
+            $this->getBlobInstance($containerName, $blobName, $snapshotId);
+        } catch (Zend_Service_WindowsAzure_Exception $e) {
+            return false;
+        }
+
+        return true;
+    }
+
+    /**
+     * Check if a container exists
+     *
+     * @param string $containerName Container name
+     * @return boolean
+     */
+    public function containerExists($containerName = '')
+    {
+        if ($containerName === '') {
+            throw new Zend_Service_WindowsAzure_Exception('Container name is not specified.');
+        }
+        if (!self::isValidContainerName($containerName)) {
+            throw new Zend_Service_WindowsAzure_Exception('Container name does not adhere to container naming conventions. See http://msdn.microsoft.com/en-us/library/dd135715.aspx for more information.');
+        }
+            
+        // List containers
+        $containers = $this->listContainers($containerName, 1);
+        foreach ($containers as $container) {
+            if ($container->Name == $containerName) {
+                return true;
+            }
+        }
+
+        return false;
+    }
+
+    /**
+     * Create container
+     *
+     * @param string $containerName Container name
+     * @param array  $metadata      Key/value pairs of meta data
+     * @return object Container properties
+     * @throws Zend_Service_WindowsAzure_Exception
+     */
+    public function createContainer($containerName = '', $metadata = array())
+    {
+        if ($containerName === '') {
+            throw new Zend_Service_WindowsAzure_Exception('Container name is not specified.');
+        }
+        if (!self::isValidContainerName($containerName)) {
+            throw new Zend_Service_WindowsAzure_Exception('Container name does not adhere to container naming conventions. See http://msdn.microsoft.com/en-us/library/dd135715.aspx for more information.');
+        }
+        if (!is_array($metadata)) {
+            throw new Zend_Service_WindowsAzure_Exception('Meta data should be an array of key and value pairs.');
+        }
+            
+        // Create metadata headers
+        $headers = array();
+        $headers = array_merge($headers, $this->_generateMetadataHeaders($metadata));
+
+        // Perform request
+        $response = $this->_performRequest($containerName, '?restype=container', Zend_Http_Client::PUT, $headers, false, null, Zend_Service_WindowsAzure_Storage::RESOURCE_CONTAINER, Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PERMISSION_WRITE);
+        if ($response->isSuccessful()) {
+            return new Zend_Service_WindowsAzure_Storage_BlobContainer(
+            $containerName,
+            $response->getHeader('Etag'),
+            $response->getHeader('Last-modified'),
+            $metadata
+            );
+        } else {
+            throw new Zend_Service_WindowsAzure_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
+        }
+    }
+
+    /**
+     * Get container ACL
+     *
+     * @param string $containerName Container name
+     * @param bool   $signedIdentifiers Display only private/blob/container or display signed identifiers?
+     * @return string Acl, to be compared with Zend_Service_WindowsAzure_Storage_Blob::ACL_*
+     * @throws Zend_Service_WindowsAzure_Exception
+     */
+    public function getContainerAcl($containerName = '', $signedIdentifiers = false)
+    {
+        if ($containerName === '') {
+            throw new Zend_Service_WindowsAzure_Exception('Container name is not specified.');
+        }
+        if (!self::isValidContainerName($containerName)) {
+            throw new Zend_Service_WindowsAzure_Exception('Container name does not adhere to container naming conventions. See http://msdn.microsoft.com/en-us/library/dd135715.aspx for more information.');
+        }
+
+        // Perform request
+        $response = $this->_performRequest($containerName, '?restype=container&comp=acl', Zend_Http_Client::GET, array(), false, null, Zend_Service_WindowsAzure_Storage::RESOURCE_CONTAINER, Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PERMISSION_READ);
+        if ($response->isSuccessful()) {
+            if ($signedIdentifiers == false)  {
+                // Only private/blob/container
+                $accessType = $response->getHeader(Zend_Service_WindowsAzure_Storage::PREFIX_STORAGE_HEADER . 'blob-public-access');
+                if (strtolower($accessType) == 'true') {
+                    $accessType = self::ACL_PUBLIC_CONTAINER;
+                }
+                return $accessType;
+            } else {
+                // Parse result
+                $result = $this->_parseResponse($response);
+                if (!$result) {
+                    return array();
+                }
+
+                $entries = null;
+                if ($result->SignedIdentifier) {
+                    if (count($result->SignedIdentifier) > 1) {
+                        $entries = $result->SignedIdentifier;
+                    } else {
+                        $entries = array($result->SignedIdentifier);
+                    }
+                }
+
+                // Return value
+                $returnValue = array();
+                foreach ($entries as $entry) {
+                    $returnValue[] = new Zend_Service_WindowsAzure_Storage_SignedIdentifier(
+                    $entry->Id,
+                    $entry->AccessPolicy ? $entry->AccessPolicy->Start ? $entry->AccessPolicy->Start : '' : '',
+                    $entry->AccessPolicy ? $entry->AccessPolicy->Expiry ? $entry->AccessPolicy->Expiry : '' : '',
+                    $entry->AccessPolicy ? $entry->AccessPolicy->Permission ? $entry->AccessPolicy->Permission : '' : ''
+                    );
+                }
+
+                // Return
+                return $returnValue;
+            }
+        } else {
+            throw new Zend_Service_WindowsAzure_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
+        }
+    }
+
+    /**
+     * Set container ACL
+     *
+     * @param string $containerName Container name
+     * @param bool $acl Zend_Service_WindowsAzure_Storage_Blob::ACL_*
+     * @param array $signedIdentifiers Signed identifiers
+     * @throws Zend_Service_WindowsAzure_Exception
+     */
+    public function setContainerAcl($containerName = '', $acl = self::ACL_PRIVATE, $signedIdentifiers = array())
+    {
+        if ($containerName === '') {
+            throw new Zend_Service_WindowsAzure_Exception('Container name is not specified.');
+        }
+        if (!self::isValidContainerName($containerName)) {
+            throw new Zend_Service_WindowsAzure_Exception('Container name does not adhere to container naming conventions. See http://msdn.microsoft.com/en-us/library/dd135715.aspx for more information.');
+        }
+
+        // Headers
+        $headers = array();
+
+        // Acl specified?
+        if ($acl != self::ACL_PRIVATE && $acl !== null && $acl != '') {
+            $headers[Zend_Service_WindowsAzure_Storage::PREFIX_STORAGE_HEADER . 'blob-public-access'] = $acl;
+        }
+
+        // Policies
+        $policies = null;
+        if (is_array($signedIdentifiers) && count($signedIdentifiers) > 0) {
+            $policies  = '';
+            $policies .= '<?xml version="1.0" encoding="utf-8"?>' . "\r\n";
+            $policies .= '<SignedIdentifiers>' . "\r\n";
+            foreach ($signedIdentifiers as $signedIdentifier) {
+                $policies .= '  <SignedIdentifier>' . "\r\n";
+                $policies .= '    <Id>' . $signedIdentifier->Id . '</Id>' . "\r\n";
+                $policies .= '    <AccessPolicy>' . "\r\n";
+                if ($signedIdentifier->Start != '')
+                $policies .= '      <Start>' . $signedIdentifier->Start . '</Start>' . "\r\n";
+                if ($signedIdentifier->Expiry != '')
+                $policies .= '      <Expiry>' . $signedIdentifier->Expiry . '</Expiry>' . "\r\n";
+                if ($signedIdentifier->Permissions != '')
+                $policies .= '      <Permission>' . $signedIdentifier->Permissions . '</Permission>' . "\r\n";
+                $policies .= '    </AccessPolicy>' . "\r\n";
+                $policies .= '  </SignedIdentifier>' . "\r\n";
+            }
+            $policies .= '</SignedIdentifiers>' . "\r\n";
+        }
+
+        // Perform request
+        $response = $this->_performRequest($containerName, '?restype=container&comp=acl', Zend_Http_Client::PUT, $headers, false, $policies, Zend_Service_WindowsAzure_Storage::RESOURCE_CONTAINER, Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PERMISSION_WRITE);
+        if (!$response->isSuccessful()) {
+            throw new Zend_Service_WindowsAzure_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
+        }
+    }
+
+    /**
+     * Get container
+     *
+     * @param string $containerName  Container name
+     * @return Zend_Service_WindowsAzure_Storage_BlobContainer
+     * @throws Zend_Service_WindowsAzure_Exception
+     */
+    public function getContainer($containerName = '')
+    {
+        if ($containerName === '') {
+            throw new Zend_Service_WindowsAzure_Exception('Container name is not specified.');
+        }
+        if (!self::isValidContainerName($containerName)) {
+            throw new Zend_Service_WindowsAzure_Exception('Container name does not adhere to container naming conventions. See http://msdn.microsoft.com/en-us/library/dd135715.aspx for more information.');
+        }
+
+        // Perform request
+        $response = $this->_performRequest($containerName, '?restype=container', Zend_Http_Client::GET, array(), false, null, Zend_Service_WindowsAzure_Storage::RESOURCE_CONTAINER, Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PERMISSION_READ);
+        if ($response->isSuccessful()) {
+            // Parse metadata
+            $metadata = $this->_parseMetadataHeaders($response->getHeaders());
+
+            // Return container
+            return new Zend_Service_WindowsAzure_Storage_BlobContainer(
+            $containerName,
+            $response->getHeader('Etag'),
+            $response->getHeader('Last-modified'),
+            $metadata
+            );
+        } else {
+            throw new Zend_Service_WindowsAzure_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
+        }
+    }
+
+    /**
+     * Get container metadata
+     *
+     * @param string $containerName  Container name
+     * @return array Key/value pairs of meta data
+     * @throws Zend_Service_WindowsAzure_Exception
+     */
+    public function getContainerMetadata($containerName = '')
+    {
+        if ($containerName === '') {
+            throw new Zend_Service_WindowsAzure_Exception('Container name is not specified.');
+        }
+        if (!self::isValidContainerName($containerName)) {
+            throw new Zend_Service_WindowsAzure_Exception('Container name does not adhere to container naming conventions. See http://msdn.microsoft.com/en-us/library/dd135715.aspx for more information.');
+        }
+
+        return $this->getContainer($containerName)->Metadata;
+    }
+
+    /**
+     * Set container metadata
+     *
+     * Calling the Set Container Metadata operation overwrites all existing metadata that is associated with the container. It's not possible to modify an individual name/value pair.
+     *
+     * @param string $containerName      Container name
+     * @param array  $metadata           Key/value pairs of meta data
+     * @param array  $additionalHeaders  Additional headers. See http://msdn.microsoft.com/en-us/library/dd179371.aspx for more information.
+     * @throws Zend_Service_WindowsAzure_Exception
+     */
+    public function setContainerMetadata($containerName = '', $metadata = array(), $additionalHeaders = array())
+    {
+        if ($containerName === '') {
+            throw new Zend_Service_WindowsAzure_Exception('Container name is not specified.');
+        }
+        if (!self::isValidContainerName($containerName)) {
+            throw new Zend_Service_WindowsAzure_Exception('Container name does not adhere to container naming conventions. See http://msdn.microsoft.com/en-us/library/dd135715.aspx for more information.');
+        }
+        if (!is_array($metadata)) {
+            throw new Zend_Service_WindowsAzure_Exception('Meta data should be an array of key and value pairs.');
+        }
+        if (count($metadata) == 0) {
+            return;
+        }
+
+        // Create metadata headers
+        $headers = array();
+        $headers = array_merge($headers, $this->_generateMetadataHeaders($metadata));
+
+        // Additional headers?
+        foreach ($additionalHeaders as $key => $value) {
+            $headers[$key] = $value;
+        }
+
+        // Perform request
+        $response = $this->_performRequest($containerName, '?restype=container&comp=metadata', Zend_Http_Client::PUT, $headers, false, null, Zend_Service_WindowsAzure_Storage::RESOURCE_CONTAINER, Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PERMISSION_WRITE);
+        if (!$response->isSuccessful()) {
+            throw new Zend_Service_WindowsAzure_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
+        }
+    }
+
+    /**
+     * Delete container
+     *
+     * @param string $containerName      Container name
+     * @param array  $additionalHeaders  Additional headers. See http://msdn.microsoft.com/en-us/library/dd179371.aspx for more information.
+     * @throws Zend_Service_WindowsAzure_Exception
+     */
+    public function deleteContainer($containerName = '', $additionalHeaders = array())
+    {
+        if ($containerName === '') {
+            throw new Zend_Service_WindowsAzure_Exception('Container name is not specified.');
+        }
+        if (!self::isValidContainerName($containerName)) {
+            throw new Zend_Service_WindowsAzure_Exception('Container name does not adhere to container naming conventions. See http://msdn.microsoft.com/en-us/library/dd135715.aspx for more information.');
+        }
+            
+        // Additional headers?
+        $headers = array();
+        foreach ($additionalHeaders as $key => $value) {
+            $headers[$key] = $value;
+        }
+
+        // Perform request
+        $response = $this->_performRequest($containerName, '?restype=container', Zend_Http_Client::DELETE, $headers, false, null, Zend_Service_WindowsAzure_Storage::RESOURCE_CONTAINER, Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PERMISSION_WRITE);
+        if (!$response->isSuccessful()) {
+            throw new Zend_Service_WindowsAzure_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
+        }
+    }
+
+    /**
+     * List containers
+     *
+     * @param string $prefix     Optional. Filters the results to return only containers whose name begins with the specified prefix.
+     * @param int    $maxResults Optional. Specifies the maximum number of containers to return per call to Azure storage. This does NOT affect list size returned by this function. (maximum: 5000)
+     * @param string $marker     Optional string value that identifies the portion of the list to be returned with the next list operation.
+     * @param string $include    Optional. Include this parameter to specify that the container's metadata be returned as part of the response body. (allowed values: '', 'metadata')
+     * @param int    $currentResultCount Current result count (internal use)
+     * @return array
+     * @throws Zend_Service_WindowsAzure_Exception
+     */
+    public function listContainers($prefix = null, $maxResults = null, $marker = null, $include = null, $currentResultCount = 0)
+    {
+        // Build query string
+        $queryString = array('comp=list');
+        if ($prefix !== null) {
+            $queryString[] = 'prefix=' . $prefix;
+        }
+        if ($maxResults !== null) {
+            $queryString[] = 'maxresults=' . $maxResults;
+        }
+        if ($marker !== null) {
+            $queryString[] = 'marker=' . $marker;
+        }
+        if ($include !== null) {
+            $queryString[] = 'include=' . $include;
+        }
+        $queryString = self::createQueryStringFromArray($queryString);
+        
+        // Perform request
+        $response = $this->_performRequest('', $queryString, Zend_Http_Client::GET, array(), false, null, Zend_Service_WindowsAzure_Storage::RESOURCE_CONTAINER, Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PERMISSION_LIST);
+        if ($response->isSuccessful()) {
+            $xmlContainers = $this->_parseResponse($response)->Containers->Container;
+            $xmlMarker = (string)$this->_parseResponse($response)->NextMarker;
+
+            $containers = array();
+            if ($xmlContainers !== null) {
+                for ($i = 0; $i < count($xmlContainers); $i++) {
+                    $containers[] = new Zend_Service_WindowsAzure_Storage_BlobContainer(
+                    (string)$xmlContainers[$i]->Name,
+                    (string)$xmlContainers[$i]->Etag,
+                    (string)$xmlContainers[$i]->LastModified,
+                    $this->_parseMetadataElement($xmlContainers[$i])
+                    );
+                }
+            }
+            $currentResultCount = $currentResultCount + count($containers);
+            if ($maxResults !== null && $currentResultCount < $maxResults) {
+                if ($xmlMarker !== null && $xmlMarker != '') {
+                    $containers = array_merge($containers, $this->listContainers($prefix, $maxResults, $xmlMarker, $include, $currentResultCount));
+                }
+            }
+            if ($maxResults !== null && count($containers) > $maxResults) {
+                $containers = array_slice($containers, 0, $maxResults);
+            }
+            
+            return $containers;
+        } else {
+            throw new Zend_Service_WindowsAzure_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
+        }
+    }
+
+    /**
+     * Put blob
+     *
+     * @param string $containerName      Container name
+     * @param string $blobName           Blob name
+     * @param string $localFileName      Local file name to be uploaded
+     * @param array  $metadata           Key/value pairs of meta data
+     * @param string $leaseId            Lease identifier
+     * @param array  $additionalHeaders  Additional headers. See http://msdn.microsoft.com/en-us/library/dd179371.aspx for more information.
+     * @return object Partial blob properties
+     * @throws Zend_Service_WindowsAzure_Exception
+     */
+    public function putBlob($containerName = '', $blobName = '', $localFileName = '', $metadata = array(), $leaseId = null, $additionalHeaders = array())
+    {
+        if ($containerName === '') {
+            throw new Zend_Service_WindowsAzure_Exception('Container name is not specified.');
+        }
+        if (!self::isValidContainerName($containerName)) {
+            throw new Zend_Service_WindowsAzure_Exception('Container name does not adhere to container naming conventions. See http://msdn.microsoft.com/en-us/library/dd135715.aspx for more information.');
+        }
+        if ($blobName === '') {
+            throw new Zend_Service_WindowsAzure_Exception('Blob name is not specified.');
+        }
+        if ($localFileName === '') {
+            throw new Zend_Service_WindowsAzure_Exception('Local file name is not specified.');
+        }
+        if (!file_exists($localFileName)) {
+            throw new Zend_Service_WindowsAzure_Exception('Local file not found.');
+        }
+        if ($containerName === '$root' && strpos($blobName, '/') !== false) {
+            throw new Zend_Service_WindowsAzure_Exception('Blobs stored in the root container can not have a name containing a forward slash (/).');
+        }
+            
+        // Check file size
+        if (filesize($localFileName) >= self::MAX_BLOB_SIZE) {
+            return $this->putLargeBlob($containerName, $blobName, $localFileName, $metadata, $leaseId);
+        }
+
+        // Put the data to Windows Azure Storage
+        return $this->putBlobData($containerName, $blobName, file_get_contents($localFileName), $metadata, $leaseId, $additionalHeaders);
+    }
+
+    /**
+     * Put blob data
+     *
+     * @param string $containerName      Container name
+     * @param string $blobName           Blob name
+     * @param mixed  $data               Data to store
+     * @param array  $metadata           Key/value pairs of meta data
+     * @param string $leaseId            Lease identifier
+     * @param array  $additionalHeaders  Additional headers. See http://msdn.microsoft.com/en-us/library/dd179371.aspx for more information.
+     * @return object Partial blob properties
+     * @throws Zend_Service_WindowsAzure_Exception
+     */
+    public function putBlobData($containerName = '', $blobName = '', $data = '', $metadata = array(), $leaseId = null, $additionalHeaders = array())
+    {
+        if ($containerName === '') {
+            throw new Zend_Service_WindowsAzure_Exception('Container name is not specified.');
+        }
+        if (!self::isValidContainerName($containerName)) {
+            throw new Zend_Service_WindowsAzure_Exception('Container name does not adhere to container naming conventions. See http://msdn.microsoft.com/en-us/library/dd135715.aspx for more information.');
+        }
+        if ($blobName === '') {
+            throw new Zend_Service_WindowsAzure_Exception('Blob name is not specified.');
+        }
+        if ($containerName === '$root' && strpos($blobName, '/') !== false) {
+            throw new Zend_Service_WindowsAzure_Exception('Blobs stored in the root container can not have a name containing a forward slash (/).');
+        }
+
+        // Create metadata headers
+        $headers = array();
+        if ($leaseId !== null) {
+            $headers['x-ms-lease-id'] = $leaseId;
+        }
+        $headers = array_merge($headers, $this->_generateMetadataHeaders($metadata));
+
+        // Additional headers?
+        foreach ($additionalHeaders as $key => $value) {
+            $headers[$key] = $value;
+        }
+
+        // Specify blob type
+        $headers[Zend_Service_WindowsAzure_Storage::PREFIX_STORAGE_HEADER . 'blob-type'] = self::BLOBTYPE_BLOCK;
+
+        // Resource name
+        $resourceName = self::createResourceName($containerName , $blobName);
+
+        // Perform request
+        $response = $this->_performRequest($resourceName, '', Zend_Http_Client::PUT, $headers, false, $data, Zend_Service_WindowsAzure_Storage::RESOURCE_BLOB, Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PERMISSION_WRITE);
+        if ($response->isSuccessful()) {
+            return new Zend_Service_WindowsAzure_Storage_BlobInstance(
+            $containerName,
+            $blobName,
+            null,
+            $response->getHeader('Etag'),
+            $response->getHeader('Last-modified'),
+            $this->getBaseUrl() . '/' . $containerName . '/' . $blobName,
+            strlen($data),
+                '',
+                '',
+                '',
+            false,
+            $metadata
+            );
+        } else {
+            throw new Zend_Service_WindowsAzure_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
+        }
+    }
+
+    /**
+     * Put large blob (> 64 MB)
+     *
+     * @param string $containerName Container name
+     * @param string $blobName Blob name
+     * @param string $localFileName Local file name to be uploaded
+     * @param array  $metadata      Key/value pairs of meta data
+     * @param string $leaseId       Lease identifier
+     * @return object Partial blob properties
+     * @throws Zend_Service_WindowsAzure_Exception
+     */
+    public function putLargeBlob($containerName = '', $blobName = '', $localFileName = '', $metadata = array(), $leaseId = null)
+    {
+        if ($containerName === '') {
+            throw new Zend_Service_WindowsAzure_Exception('Container name is not specified.');
+        }
+        if (!self::isValidContainerName($containerName)) {
+            throw new Zend_Service_WindowsAzure_Exception('Container name does not adhere to container naming conventions. See http://msdn.microsoft.com/en-us/library/dd135715.aspx for more information.');
+        }
+        if ($blobName === '') {
+            throw new Zend_Service_WindowsAzure_Exception('Blob name is not specified.');
+        }
+        if ($localFileName === '') {
+            throw new Zend_Service_WindowsAzure_Exception('Local file name is not specified.');
+        }
+        if (!file_exists($localFileName)) {
+            throw new Zend_Service_WindowsAzure_Exception('Local file not found.');
+        }
+        if ($containerName === '$root' && strpos($blobName, '/') !== false) {
+            throw new Zend_Service_WindowsAzure_Exception('Blobs stored in the root container can not have a name containing a forward slash (/).');
+        }
+            
+        // Check file size
+        if (filesize($localFileName) < self::MAX_BLOB_SIZE) {
+            return $this->putBlob($containerName, $blobName, $localFileName, $metadata);
+        }
+            
+        // Determine number of parts
+        $numberOfParts = ceil( filesize($localFileName) / self::MAX_BLOB_TRANSFER_SIZE );
+
+        // Generate block id's
+        $blockIdentifiers = array();
+        for ($i = 0; $i < $numberOfParts; $i++) {
+            $blockIdentifiers[] = $this->_generateBlockId($i);
+        }
+
+        // Open file
+        $fp = fopen($localFileName, 'r');
+        if ($fp === false) {
+            throw new Zend_Service_WindowsAzure_Exception('Could not open local file.');
+        }
+            
+        // Upload parts
+        for ($i = 0; $i < $numberOfParts; $i++) {
+            // Seek position in file
+            fseek($fp, $i * self::MAX_BLOB_TRANSFER_SIZE);
+                
+            // Read contents
+            $fileContents = fread($fp, self::MAX_BLOB_TRANSFER_SIZE);
+                
+            // Put block
+            $this->putBlock($containerName, $blobName, $blockIdentifiers[$i], $fileContents, $leaseId);
+                
+            // Dispose file contents
+            $fileContents = null;
+            unset($fileContents);
+        }
+
+        // Close file
+        fclose($fp);
+
+        // Put block list
+        $this->putBlockList($containerName, $blobName, $blockIdentifiers, $metadata, $leaseId);
+
+        // Return information of the blob
+        return $this->getBlobInstance($containerName, $blobName, null, $leaseId);
+    }
+        
+    /**
+     * Put large blob block
+     *
+     * @param string $containerName Container name
+     * @param string $blobName      Blob name
+     * @param string $identifier    Block ID
+     * @param array  $contents      Contents of the block
+     * @param string $leaseId       Lease identifier
+     * @throws Zend_Service_WindowsAzure_Exception
+     */
+    public function putBlock($containerName = '', $blobName = '', $identifier = '', $contents = '', $leaseId = null)
+    {
+        if ($containerName === '') {
+            throw new Zend_Service_WindowsAzure_Exception('Container name is not specified.');
+        }
+        if (!self::isValidContainerName($containerName)) {
+            throw new Zend_Service_WindowsAzure_Exception('Container name does not adhere to container naming conventions. See http://msdn.microsoft.com/en-us/library/dd135715.aspx for more information.');
+        }
+        if ($identifier === '') {
+            throw new Zend_Service_WindowsAzure_Exception('Block identifier is not specified.');
+        }
+        if (strlen($contents) > self::MAX_BLOB_TRANSFER_SIZE) {
+            throw new Zend_Service_WindowsAzure_Exception('Block size is too big.');
+        }
+        if ($containerName === '$root' && strpos($blobName, '/') !== false) {
+            throw new Zend_Service_WindowsAzure_Exception('Blobs stored in the root container can not have a name containing a forward slash (/).');
+        }
+
+        // Headers
+        $headers = array();
+        if ($leaseId !== null) {
+            $headers['x-ms-lease-id'] = $leaseId;
+        }
+            
+        // Resource name
+        $resourceName = self::createResourceName($containerName , $blobName);
+
+        // Upload
+        $response = $this->_performRequest($resourceName, '?comp=block&blockid=' . base64_encode($identifier), Zend_Http_Client::PUT, $headers, false, $contents, Zend_Service_WindowsAzure_Storage::RESOURCE_BLOB, Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PERMISSION_WRITE);
+        if (!$response->isSuccessful()) {
+            throw new Zend_Service_WindowsAzure_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
+        }
+    }
+
+    /**
+     * Put block list
+     *
+     * @param string $containerName      Container name
+     * @param string $blobName           Blob name
+     * @param array $blockList           Array of block identifiers
+     * @param array  $metadata           Key/value pairs of meta data
+     * @param string $leaseId            Lease identifier
+     * @param array  $additionalHeaders  Additional headers. See http://msdn.microsoft.com/en-us/library/dd179371.aspx for more information.
+     * @throws Zend_Service_WindowsAzure_Exception
+     */
+    public function putBlockList($containerName = '', $blobName = '', $blockList = array(), $metadata = array(), $leaseId = null, $additionalHeaders = array())
+    {
+        if ($containerName === '') {
+            throw new Zend_Service_WindowsAzure_Exception('Container name is not specified.');
+        }
+        if (!self::isValidContainerName($containerName)) {
+            throw new Zend_Service_WindowsAzure_Exception('Container name does not adhere to container naming conventions. See http://msdn.microsoft.com/en-us/library/dd135715.aspx for more information.');
+        }
+        if ($blobName === '') {
+            throw new Zend_Service_WindowsAzure_Exception('Blob name is not specified.');
+        }
+        if (count($blockList) == 0) {
+            throw new Zend_Service_WindowsAzure_Exception('Block list does not contain any elements.');
+        }
+        if ($containerName === '$root' && strpos($blobName, '/') !== false) {
+            throw new Zend_Service_WindowsAzure_Exception('Blobs stored in the root container can not have a name containing a forward slash (/).');
+        }
+
+        // Generate block list
+        $blocks = '';
+        foreach ($blockList as $block) {
+            $blocks .= '  <Latest>' . base64_encode($block) . '</Latest>' . "\n";
+        }
+
+        // Generate block list request
+        $fileContents = utf8_encode(implode("\n", array(
+            '<?xml version="1.0" encoding="utf-8"?>',
+            '<BlockList>',
+        $blocks,
+            '</BlockList>'
+            )));
+
+            // Create metadata headers
+            $headers = array();
+            if ($leaseId !== null) {
+                $headers['x-ms-lease-id'] = $leaseId;
+            }
+            $headers = array_merge($headers, $this->_generateMetadataHeaders($metadata));
+
+            // Additional headers?
+            foreach ($additionalHeaders as $key => $value) {
+                $headers[$key] = $value;
+            }
+
+            // Resource name
+            $resourceName = self::createResourceName($containerName , $blobName);
+
+            // Perform request
+            $response = $this->_performRequest($resourceName, '?comp=blocklist', Zend_Http_Client::PUT, $headers, false, $fileContents, Zend_Service_WindowsAzure_Storage::RESOURCE_BLOB, Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PERMISSION_WRITE);
+            if (!$response->isSuccessful()) {
+                throw new Zend_Service_WindowsAzure_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
+            }
+    }
+
+    /**
+     * Get block list
+     *
+     * @param string $containerName Container name
+     * @param string $blobName      Blob name
+     * @param string $snapshotId    Snapshot identifier
+     * @param string $leaseId       Lease identifier
+     * @param integer $type         Type of block list to retrieve. 0 = all, 1 = committed, 2 = uncommitted
+     * @return array
+     * @throws Zend_Service_WindowsAzure_Exception
+     */
+    public function getBlockList($containerName = '', $blobName = '', $snapshotId = null, $leaseId = null, $type = 0)
+    {
+        if ($containerName === '') {
+            throw new Zend_Service_WindowsAzure_Exception('Container name is not specified.');
+        }
+        if (!self::isValidContainerName($containerName)) {
+            throw new Zend_Service_WindowsAzure_Exception('Container name does not adhere to container naming conventions. See http://msdn.microsoft.com/en-us/library/dd135715.aspx for more information.');
+        }
+        if ($blobName === '') {
+            throw new Zend_Service_WindowsAzure_Exception('Blob name is not specified.');
+        }
+        if ($type < 0 || $type > 2) {
+            throw new Zend_Service_WindowsAzure_Exception('Invalid type of block list to retrieve.');
+        }
+
+        // Set $blockListType
+        $blockListType = 'all';
+        if ($type == 1) {
+            $blockListType = 'committed';
+        }
+        if ($type == 2) {
+            $blockListType = 'uncommitted';
+        }
+
+        // Headers
+        $headers = array();
+        if ($leaseId !== null) {
+            $headers['x-ms-lease-id'] = $leaseId;
+        }
+
+        // Build query string
+        $queryString = array('comp=blocklist', 'blocklisttype=' . $blockListType);
+        if ($snapshotId !== null) {
+            $queryString[] = 'snapshot=' . $snapshotId;
+        }
+        $queryString = self::createQueryStringFromArray($queryString);
+
+        // Resource name
+        $resourceName = self::createResourceName($containerName , $blobName);
+            
+        // Perform request
+        $response = $this->_performRequest($resourceName, $queryString, Zend_Http_Client::GET, $headers, false, null, Zend_Service_WindowsAzure_Storage::RESOURCE_BLOB, Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PERMISSION_READ);
+        if ($response->isSuccessful()) {
+            // Parse response
+            $blockList = $this->_parseResponse($response);
+
+            // Create return value
+            $returnValue = array();
+            if ($blockList->CommittedBlocks) {
+                foreach ($blockList->CommittedBlocks->Block as $block) {
+                    $returnValue['CommittedBlocks'][] = (object)array(
+                        'Name' => (string)$block->Name,
+                        'Size' => (string)$block->Size
+                    );
+                }
+            }
+            if ($blockList->UncommittedBlocks)  {
+                foreach ($blockList->UncommittedBlocks->Block as $block) {
+                    $returnValue['UncommittedBlocks'][] = (object)array(
+                        'Name' => (string)$block->Name,
+                        'Size' => (string)$block->Size
+                    );
+                }
+            }
+
+            return $returnValue;
+        } else {
+            throw new Zend_Service_WindowsAzure_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
+        }
+    }
+
+    /**
+     * Create page blob
+     *
+     * @param string $containerName      Container name
+     * @param string $blobName           Blob name
+     * @param int    $size               Size of the page blob in bytes
+     * @param array  $metadata           Key/value pairs of meta data
+     * @param string $leaseId            Lease identifier
+     * @param array  $additionalHeaders  Additional headers. See http://msdn.microsoft.com/en-us/library/dd179371.aspx for more information.
+     * @return object Partial blob properties
+     * @throws Zend_Service_WindowsAzure_Exception
+     */
+    public function createPageBlob($containerName = '', $blobName = '', $size = 0, $metadata = array(), $leaseId = null, $additionalHeaders = array())
+    {
+        if ($containerName === '') {
+            throw new Zend_Service_WindowsAzure_Exception('Container name is not specified.');
+        }
+        if (!self::isValidContainerName($containerName)) {
+            throw new Zend_Service_WindowsAzure_Exception('Container name does not adhere to container naming conventions. See http://msdn.microsoft.com/en-us/library/dd135715.aspx for more information.');
+        }
+        if ($blobName === '') {
+            throw new Zend_Service_WindowsAzure_Exception('Blob name is not specified.');
+        }
+        if ($containerName === '$root' && strpos($blobName, '/') !== false) {
+            throw new Zend_Service_WindowsAzure_Exception('Blobs stored in the root container can not have a name containing a forward slash (/).');
+        }
+        if ($size <= 0) {
+            throw new Zend_Service_WindowsAzure_Exception('Page blob size must be specified.');
+        }
+
+        // Create metadata headers
+        $headers = array();
+        if ($leaseId !== null) {
+            $headers['x-ms-lease-id'] = $leaseId;
+        }
+        $headers = array_merge($headers, $this->_generateMetadataHeaders($metadata));
+
+        // Additional headers?
+        foreach ($additionalHeaders as $key => $value) {
+            $headers[$key] = $value;
+        }
+
+        // Specify blob type & blob length
+        $headers[Zend_Service_WindowsAzure_Storage::PREFIX_STORAGE_HEADER . 'blob-type'] = self::BLOBTYPE_PAGE;
+        $headers[Zend_Service_WindowsAzure_Storage::PREFIX_STORAGE_HEADER . 'blob-content-length'] = $size;
+        $headers['Content-Length'] = 0;
+
+        // Resource name
+        $resourceName = self::createResourceName($containerName , $blobName);
+
+        // Perform request
+        $response = $this->_performRequest($resourceName, '', Zend_Http_Client::PUT, $headers, false, '', Zend_Service_WindowsAzure_Storage::RESOURCE_BLOB, Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PERMISSION_WRITE);
+        if ($response->isSuccessful()) {
+            return new Zend_Service_WindowsAzure_Storage_BlobInstance(
+            $containerName,
+            $blobName,
+            null,
+            $response->getHeader('Etag'),
+            $response->getHeader('Last-modified'),
+            $this->getBaseUrl() . '/' . $containerName . '/' . $blobName,
+            $size,
+                '',
+                '',
+                '',
+            false,
+            $metadata
+            );
+        } else {
+            throw new Zend_Service_WindowsAzure_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
+        }
+    }
+
+    /**
+     * Put page in page blob
+     *
+     * @param string $containerName      Container name
+     * @param string $blobName           Blob name
+     * @param int    $startByteOffset    Start byte offset
+     * @param int    $endByteOffset      End byte offset
+     * @param mixed  $contents             Page contents
+     * @param string $writeMethod        Write method (Zend_Service_WindowsAzure_Storage_Blob::PAGE_WRITE_*)
+     * @param string $leaseId            Lease identifier
+     * @param array  $additionalHeaders  Additional headers. See http://msdn.microsoft.com/en-us/library/dd179371.aspx for more information.
+     * @throws Zend_Service_WindowsAzure_Exception
+     */
+    public function putPage($containerName = '', $blobName = '', $startByteOffset = 0, $endByteOffset = 0, $contents = '', $writeMethod = self::PAGE_WRITE_UPDATE, $leaseId = null, $additionalHeaders = array())
+    {
+        if ($containerName === '') {
+            throw new Zend_Service_WindowsAzure_Exception('Container name is not specified.');
+        }
+        if (!self::isValidContainerName($containerName)) {
+            throw new Zend_Service_WindowsAzure_Exception('Container name does not adhere to container naming conventions. See http://msdn.microsoft.com/en-us/library/dd135715.aspx for more information.');
+        }
+        if ($blobName === '') {
+            throw new Zend_Service_WindowsAzure_Exception('Blob name is not specified.');
+        }
+        if ($containerName === '$root' && strpos($blobName, '/') !== false) {
+            throw new Zend_Service_WindowsAzure_Exception('Blobs stored in the root container can not have a name containing a forward slash (/).');
+        }
+        if ($startByteOffset % 512 != 0) {
+            throw new Zend_Service_WindowsAzure_Exception('Start byte offset must be a modulus of 512.');
+        }
+        if (($endByteOffset + 1) % 512 != 0) {
+            throw new Zend_Service_WindowsAzure_Exception('End byte offset must be a modulus of 512 minus 1.');
+        }
+
+        // Determine size
+        $size = strlen($contents);
+        if ($size >= self::MAX_BLOB_TRANSFER_SIZE) {
+            throw new Zend_Service_WindowsAzure_Exception('Page blob size must not be larger than ' + self::MAX_BLOB_TRANSFER_SIZE . ' bytes.');
+        }
+
+        // Create metadata headers
+        $headers = array();
+        if ($leaseId !== null) {
+            $headers['x-ms-lease-id'] = $leaseId;
+        }
+
+        // Additional headers?
+        foreach ($additionalHeaders as $key => $value) {
+            $headers[$key] = $value;
+        }
+
+        // Specify range
+        $headers['Range'] = 'bytes=' . $startByteOffset . '-' . $endByteOffset;
+
+        // Write method
+        $headers[Zend_Service_WindowsAzure_Storage::PREFIX_STORAGE_HEADER . 'page-write'] = $writeMethod;
+
+        // Resource name
+        $resourceName = self::createResourceName($containerName , $blobName);
+
+        // Perform request
+        $response = $this->_performRequest($resourceName, '?comp=page', Zend_Http_Client::PUT, $headers, false, $contents, Zend_Service_WindowsAzure_Storage::RESOURCE_BLOB, Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PERMISSION_WRITE);
+        if (!$response->isSuccessful()) {
+            throw new Zend_Service_WindowsAzure_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
+        }
+    }
+
+    /**
+     * Put page in page blob
+     *
+     * @param string $containerName      Container name
+     * @param string $blobName           Blob name
+     * @param int    $startByteOffset    Start byte offset
+     * @param int    $endByteOffset      End byte offset
+     * @param string $leaseId            Lease identifier
+     * @return array Array of page ranges
+     * @throws Zend_Service_WindowsAzure_Exception
+     */
+    public function getPageRegions($containerName = '', $blobName = '', $startByteOffset = 0, $endByteOffset = 0, $leaseId = null)
+    {
+        if ($containerName === '') {
+            throw new Zend_Service_WindowsAzure_Exception('Container name is not specified.');
+        }
+        if (!self::isValidContainerName($containerName)) {
+            throw new Zend_Service_WindowsAzure_Exception('Container name does not adhere to container naming conventions. See http://msdn.microsoft.com/en-us/library/dd135715.aspx for more information.');
+        }
+        if ($blobName === '') {
+            throw new Zend_Service_WindowsAzure_Exception('Blob name is not specified.');
+        }
+        if ($containerName === '$root' && strpos($blobName, '/') !== false) {
+            throw new Zend_Service_WindowsAzure_Exception('Blobs stored in the root container can not have a name containing a forward slash (/).');
+        }
+        if ($startByteOffset % 512 != 0) {
+            throw new Zend_Service_WindowsAzure_Exception('Start byte offset must be a modulus of 512.');
+        }
+        if ($endByteOffset > 0 && ($endByteOffset + 1) % 512 != 0) {
+            throw new Zend_Service_WindowsAzure_Exception('End byte offset must be a modulus of 512 minus 1.');
+        }
+
+        // Create metadata headers
+        $headers = array();
+        if ($leaseId !== null) {
+            $headers['x-ms-lease-id'] = $leaseId;
+        }
+
+        // Specify range?
+        if ($endByteOffset > 0) {
+            $headers['Range'] = 'bytes=' . $startByteOffset . '-' . $endByteOffset;
+        }
+
+        // Resource name
+        $resourceName = self::createResourceName($containerName , $blobName);
+
+        // Perform request
+        $response = $this->_performRequest($resourceName, '?comp=pagelist', Zend_Http_Client::GET, $headers, false, null, Zend_Service_WindowsAzure_Storage::RESOURCE_BLOB, Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PERMISSION_WRITE);
+        if ($response->isSuccessful()) {
+            $result = $this->_parseResponse($response);
+            $xmlRanges = null;
+            if (count($result->PageRange) > 1) {
+                $xmlRanges = $result->PageRange;
+            } else {
+                $xmlRanges = array($result->PageRange);
+            }
+
+            $ranges = array();
+            for ($i = 0; $i < count($xmlRanges); $i++) {
+                $ranges[] = new Zend_Service_WindowsAzure_Storage_PageRegionInstance(
+                (int)$xmlRanges[$i]->Start,
+                (int)$xmlRanges[$i]->End
+                );
+            }
+            
+            return $ranges;
+        } else {
+            throw new Zend_Service_WindowsAzure_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
+        }
+    }
+        
+    /**
+     * Copy blob
+     *
+     * @param string $sourceContainerName       Source container name
+     * @param string $sourceBlobName            Source blob name
+     * @param string $destinationContainerName  Destination container name
+     * @param string $destinationBlobName       Destination blob name
+     * @param array  $metadata                  Key/value pairs of meta data
+     * @param string $sourceSnapshotId          Source snapshot identifier
+     * @param string $destinationLeaseId        Destination lease identifier
+     * @param array  $additionalHeaders         Additional headers. See http://msdn.microsoft.com/en-us/library/dd894037.aspx for more information.
+     * @return object Partial blob properties
+     * @throws Zend_Service_WindowsAzure_Exception
+     */
+    public function copyBlob($sourceContainerName = '', $sourceBlobName = '', $destinationContainerName = '', $destinationBlobName = '', $metadata = array(), $sourceSnapshotId = null, $destinationLeaseId = null, $additionalHeaders = array())
+    {
+        if ($sourceContainerName === '') {
+            throw new Zend_Service_WindowsAzure_Exception('Source container name is not specified.');
+        }
+        if (!self::isValidContainerName($sourceContainerName)) {
+            throw new Zend_Service_WindowsAzure_Exception('Source container name does not adhere to container naming conventions. See http://msdn.microsoft.com/en-us/library/dd135715.aspx for more information.');
+        }
+        if ($sourceBlobName === '') {
+            throw new Zend_Service_WindowsAzure_Exception('Source blob name is not specified.');
+        }
+        if ($destinationContainerName === '') {
+            throw new Zend_Service_WindowsAzure_Exception('Destination container name is not specified.');
+        }
+        if (!self::isValidContainerName($destinationContainerName)) {
+            throw new Zend_Service_WindowsAzure_Exception('Destination container name does not adhere to container naming conventions. See http://msdn.microsoft.com/en-us/library/dd135715.aspx for more information.');
+        }
+        if ($destinationBlobName === '') {
+            throw new Zend_Service_WindowsAzure_Exception('Destination blob name is not specified.');
+        }
+        if ($sourceContainerName === '$root' && strpos($sourceBlobName, '/') !== false) {
+            throw new Zend_Service_WindowsAzure_Exception('Blobs stored in the root container can not have a name containing a forward slash (/).');
+        }
+        if ($destinationContainerName === '$root' && strpos($destinationBlobName, '/') !== false) {
+            throw new Zend_Service_WindowsAzure_Exception('Blobs stored in the root container can not have a name containing a forward slash (/).');
+        }
+
+        // Create metadata headers
+        $headers = array();
+        if ($destinationLeaseId !== null) {
+            $headers['x-ms-lease-id'] = $destinationLeaseId;
+        }
+        $headers = array_merge($headers, $this->_generateMetadataHeaders($metadata));
+
+        // Additional headers?
+        foreach ($additionalHeaders as $key => $value) {
+            $headers[$key] = $value;
+        }
+
+        // Resource names
+        $sourceResourceName = self::createResourceName($sourceContainerName, $sourceBlobName);
+        if ($sourceSnapshotId !== null) {
+            $sourceResourceName .= '?snapshot=' . $sourceSnapshotId;
+        }
+        $destinationResourceName = self::createResourceName($destinationContainerName, $destinationBlobName);
+
+        // Set source blob
+        $headers["x-ms-copy-source"] = '/' . $this->_accountName . '/' . $sourceResourceName;
+
+        // Perform request
+        $response = $this->_performRequest($destinationResourceName, '', Zend_Http_Client::PUT, $headers, false, null, Zend_Service_WindowsAzure_Storage::RESOURCE_BLOB, Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PERMISSION_WRITE);
+        if ($response->isSuccessful()) {
+            return new Zend_Service_WindowsAzure_Storage_BlobInstance(
+            $destinationContainerName,
+            $destinationBlobName,
+            null,
+            $response->getHeader('Etag'),
+            $response->getHeader('Last-modified'),
+            $this->getBaseUrl() . '/' . $destinationContainerName . '/' . $destinationBlobName,
+            0,
+                '',
+                '',
+                '',
+            false,
+            $metadata
+            );
+        } else {
+            throw new Zend_Service_WindowsAzure_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
+        }
+    }
+
+    /**
+     * Get blob
+     *
+     * @param string $containerName      Container name
+     * @param string $blobName           Blob name
+     * @param string $localFileName      Local file name to store downloaded blob
+     * @param string $snapshotId         Snapshot identifier
+     * @param string $leaseId            Lease identifier
+     * @param array  $additionalHeaders  Additional headers. See http://msdn.microsoft.com/en-us/library/dd179371.aspx for more information.
+     * @throws Zend_Service_WindowsAzure_Exception
+     */
+    public function getBlob($containerName = '', $blobName = '', $localFileName = '', $snapshotId = null, $leaseId = null, $additionalHeaders = array())
+    {
+        if ($containerName === '') {
+            throw new Zend_Service_WindowsAzure_Exception('Container name is not specified.');
+        }
+        if (!self::isValidContainerName($containerName)) {
+            throw new Zend_Service_WindowsAzure_Exception('Container name does not adhere to container naming conventions. See http://msdn.microsoft.com/en-us/library/dd135715.aspx for more information.');
+        }
+        if ($blobName === '') {
+            throw new Zend_Service_WindowsAzure_Exception('Blob name is not specified.');
+        }
+        if ($localFileName === '') {
+            throw new Zend_Service_WindowsAzure_Exception('Local file name is not specified.');
+        }
+
+        // Fetch data
+        file_put_contents($localFileName, $this->getBlobData($containerName, $blobName, $snapshotId, $leaseId, $additionalHeaders));
+    }
+
+    /**
+     * Get blob data
+     *
+     * @param string $containerName      Container name
+     * @param string $blobName           Blob name
+     * @param string $snapshotId         Snapshot identifier
+     * @param string $leaseId            Lease identifier
+     * @param array  $additionalHeaders  Additional headers. See http://msdn.microsoft.com/en-us/library/dd179371.aspx for more information.
+     * @return mixed Blob contents
+     * @throws Zend_Service_WindowsAzure_Exception
+     */
+    public function getBlobData($containerName = '', $blobName = '', $snapshotId = null, $leaseId = null, $additionalHeaders = array())
+    {
+        if ($containerName === '') {
+            throw new Zend_Service_WindowsAzure_Exception('Container name is not specified.');
+        }
+        if (!self::isValidContainerName($containerName)) {
+            throw new Zend_Service_WindowsAzure_Exception('Container name does not adhere to container naming conventions. See http://msdn.microsoft.com/en-us/library/dd135715.aspx for more information.');
+        }
+        if ($blobName === '') {
+            throw new Zend_Service_WindowsAzure_Exception('Blob name is not specified.');
+        }
+
+        // Build query string
+        $queryString = array();
+        if ($snapshotId !== null) {
+            $queryString[] = 'snapshot=' . $snapshotId;
+        }
+        $queryString = self::createQueryStringFromArray($queryString);
+
+        // Additional headers?
+        $headers = array();
+        if ($leaseId !== null) {
+            $headers['x-ms-lease-id'] = $leaseId;
+        }
+        foreach ($additionalHeaders as $key => $value) {
+            $headers[$key] = $value;
+        }
+
+        // Resource name
+        $resourceName = self::createResourceName($containerName , $blobName);
+
+        // Perform request
+        $response = $this->_performRequest($resourceName, $queryString, Zend_Http_Client::GET, $headers, false, null, Zend_Service_WindowsAzure_Storage::RESOURCE_BLOB, Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PERMISSION_READ);
+        if ($response->isSuccessful()) {
+            return $response->getBody();
+        } else {
+            throw new Zend_Service_WindowsAzure_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
+        }
+    }
+
+    /**
+     * Get blob instance
+     *
+     * @param string $containerName      Container name
+     * @param string $blobName           Blob name
+     * @param string $snapshotId         Snapshot identifier
+     * @param string $leaseId            Lease identifier
+     * @param array  $additionalHeaders  Additional headers. See http://msdn.microsoft.com/en-us/library/dd179371.aspx for more information.
+     * @return Zend_Service_WindowsAzure_Storage_BlobInstance
+     * @throws Zend_Service_WindowsAzure_Exception
+     */
+    public function getBlobInstance($containerName = '', $blobName = '', $snapshotId = null, $leaseId = null, $additionalHeaders = array())
+    {
+        if ($containerName === '') {
+            throw new Zend_Service_WindowsAzure_Exception('Container name is not specified.');
+        }
+        if (!self::isValidContainerName($containerName)) {
+            throw new Zend_Service_WindowsAzure_Exception('Container name does not adhere to container naming conventions. See http://msdn.microsoft.com/en-us/library/dd135715.aspx for more information.');
+        }
+        if ($blobName === '') {
+            throw new Zend_Service_WindowsAzure_Exception('Blob name is not specified.');
+        }
+        if ($containerName === '$root' && strpos($blobName, '/') !== false) {
+            throw new Zend_Service_WindowsAzure_Exception('Blobs stored in the root container can not have a name containing a forward slash (/).');
+        }
+
+        // Build query string
+        $queryString = array();
+        if ($snapshotId !== null) {
+            $queryString[] = 'snapshot=' . $snapshotId;
+        }
+        $queryString = self::createQueryStringFromArray($queryString);
+        
+        // Additional headers?
+        $headers = array();
+        if ($leaseId !== null) {
+            $headers['x-ms-lease-id'] = $leaseId;
+        }
+        foreach ($additionalHeaders as $key => $value) {
+            $headers[$key] = $value;
+        }
+
+        // Resource name
+        $resourceName = self::createResourceName($containerName , $blobName);
+
+        // Perform request
+        $response = $this->_performRequest($resourceName, $queryString, Zend_Http_Client::HEAD, $headers, false, null, Zend_Service_WindowsAzure_Storage::RESOURCE_BLOB, Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PERMISSION_READ);
+        if ($response->isSuccessful()) {
+            // Parse metadata
+            $metadata = $this->_parseMetadataHeaders($response->getHeaders());
+
+            // Return blob
+            return new Zend_Service_WindowsAzure_Storage_BlobInstance(
+            $containerName,
+            $blobName,
+            $snapshotId,
+            $response->getHeader('Etag'),
+            $response->getHeader('Last-modified'),
+            $this->getBaseUrl() . '/' . $containerName . '/' . $blobName,
+            $response->getHeader('Content-Length'),
+            $response->getHeader('Content-Type'),
+            $response->getHeader('Content-Encoding'),
+            $response->getHeader('Content-Language'),
+            $response->getHeader('Cache-Control'),
+            $response->getHeader('x-ms-blob-type'),
+            $response->getHeader('x-ms-lease-status'),
+            false,
+            $metadata
+            );
+        } else {
+            throw new Zend_Service_WindowsAzure_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
+        }
+    }
+
+    /**
+     * Get blob metadata
+     *
+     * @param string $containerName  Container name
+     * @param string $blobName       Blob name
+     * @param string $snapshotId     Snapshot identifier
+     * @param string $leaseId        Lease identifier
+     * @return array Key/value pairs of meta data
+     * @throws Zend_Service_WindowsAzure_Exception
+     */
+    public function getBlobMetadata($containerName = '', $blobName = '', $snapshotId = null, $leaseId = null)
+    {
+        if ($containerName === '') {
+            throw new Zend_Service_WindowsAzure_Exception('Container name is not specified.');
+        }
+        if (!self::isValidContainerName($containerName)) {
+            throw new Zend_Service_WindowsAzure_Exception('Container name does not adhere to container naming conventions. See http://msdn.microsoft.com/en-us/library/dd135715.aspx for more information.');
+        }
+        if ($blobName === '') {
+            throw new Zend_Service_WindowsAzure_Exception('Blob name is not specified.');
+        }
+        if ($containerName === '$root' && strpos($blobName, '/') !== false) {
+            throw new Zend_Service_WindowsAzure_Exception('Blobs stored in the root container can not have a name containing a forward slash (/).');
+        }
+
+        return $this->getBlobInstance($containerName, $blobName, $snapshotId, $leaseId)->Metadata;
+    }
+
+    /**
+     * Set blob metadata
+     *
+     * Calling the Set Blob Metadata operation overwrites all existing metadata that is associated with the blob. It's not possible to modify an individual name/value pair.
+     *
+     * @param string $containerName      Container name
+     * @param string $blobName           Blob name
+     * @param array  $metadata           Key/value pairs of meta data
+     * @param string $leaseId            Lease identifier
+     * @param array  $additionalHeaders  Additional headers. See http://msdn.microsoft.com/en-us/library/dd179371.aspx for more information.
+     * @throws Zend_Service_WindowsAzure_Exception
+     */
+    public function setBlobMetadata($containerName = '', $blobName = '', $metadata = array(), $leaseId = null, $additionalHeaders = array())
+    {
+        if ($containerName === '') {
+            throw new Zend_Service_WindowsAzure_Exception('Container name is not specified.');
+        }
+        if (!self::isValidContainerName($containerName)) {
+            throw new Zend_Service_WindowsAzure_Exception('Container name does not adhere to container naming conventions. See http://msdn.microsoft.com/en-us/library/dd135715.aspx for more information.');
+        }
+        if ($blobName === '') {
+            throw new Zend_Service_WindowsAzure_Exception('Blob name is not specified.');
+        }
+        if ($containerName === '$root' && strpos($blobName, '/') !== false) {
+            throw new Zend_Service_WindowsAzure_Exception('Blobs stored in the root container can not have a name containing a forward slash (/).');
+        }
+        if (count($metadata) == 0) {
+            return;
+        }
+
+        // Create metadata headers
+        $headers = array();
+        if ($leaseId !== null) {
+            $headers['x-ms-lease-id'] = $leaseId;
+        }
+        $headers = array_merge($headers, $this->_generateMetadataHeaders($metadata));
+
+        // Additional headers?
+        foreach ($additionalHeaders as $key => $value) {
+            $headers[$key] = $value;
+        }
+
+        // Perform request
+        $response = $this->_performRequest($containerName . '/' . $blobName, '?comp=metadata', Zend_Http_Client::PUT, $headers, false, null, Zend_Service_WindowsAzure_Storage::RESOURCE_BLOB, Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PERMISSION_WRITE);
+        if (!$response->isSuccessful()) {
+            throw new Zend_Service_WindowsAzure_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
+        }
+    }
+
+    /**
+     * Set blob properties
+     *
+     * All available properties are listed at http://msdn.microsoft.com/en-us/library/ee691966.aspx and should be provided in the $additionalHeaders parameter.
+     *
+     * @param string $containerName      Container name
+     * @param string $blobName           Blob name
+     * @param string $leaseId            Lease identifier
+     * @param array  $additionalHeaders  Additional headers. See http://msdn.microsoft.com/en-us/library/dd179371.aspx for more information.
+     * @throws Zend_Service_WindowsAzure_Exception
+     */
+    public function setBlobProperties($containerName = '', $blobName = '', $leaseId = null, $additionalHeaders = array())
+    {
+        if ($containerName === '') {
+            throw new Zend_Service_WindowsAzure_Exception('Container name is not specified.');
+        }
+        if (!self::isValidContainerName($containerName)) {
+            throw new Zend_Service_WindowsAzure_Exception('Container name does not adhere to container naming conventions. See http://msdn.microsoft.com/en-us/library/dd135715.aspx for more information.');
+        }
+        if ($blobName === '') {
+            throw new Zend_Service_WindowsAzure_Exception('Blob name is not specified.');
+        }
+        if ($containerName === '$root' && strpos($blobName, '/') !== false) {
+            throw new Zend_Service_WindowsAzure_Exception('Blobs stored in the root container can not have a name containing a forward slash (/).');
+        }
+        if (count($additionalHeaders) == 0) {
+            throw new Zend_Service_WindowsAzure_Exception('No additional headers are specified.');
+        }
+
+        // Create headers
+        $headers = array();
+
+        // Lease set?
+        if ($leaseId !== null) {
+            $headers['x-ms-lease-id'] = $leaseId;
+        }
+
+        // Additional headers?
+        foreach ($additionalHeaders as $key => $value) {
+            $headers[$key] = $value;
+        }
+
+        // Perform request
+        $response = $this->_performRequest($containerName . '/' . $blobName, '?comp=properties', Zend_Http_Client::PUT, $headers, false, null, Zend_Service_WindowsAzure_Storage::RESOURCE_BLOB, Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PERMISSION_WRITE);
+        if (!$response->isSuccessful()) {
+            throw new Zend_Service_WindowsAzure_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
+        }
+    }
+
+    /**
+     * Get blob properties
+     *
+     * @param string $containerName      Container name
+     * @param string $blobName           Blob name
+     * @param string $snapshotId         Snapshot identifier
+     * @param string $leaseId            Lease identifier
+     * @return Zend_Service_WindowsAzure_Storage_BlobInstance
+     * @throws Zend_Service_WindowsAzure_Exception
+     */
+    public function getBlobProperties($containerName = '', $blobName = '', $snapshotId = null, $leaseId = null)
+    {
+        if ($containerName === '') {
+            throw new Zend_Service_WindowsAzure_Exception('Container name is not specified.');
+        }
+        if (!self::isValidContainerName($containerName)) {
+            throw new Zend_Service_WindowsAzure_Exception('Container name does not adhere to container naming conventions. See http://msdn.microsoft.com/en-us/library/dd135715.aspx for more information.');
+        }
+        if ($blobName === '') {
+            throw new Zend_Service_WindowsAzure_Exception('Blob name is not specified.');
+        }
+        if ($containerName === '$root' && strpos($blobName, '/') !== false) {
+            throw new Zend_Service_WindowsAzure_Exception('Blobs stored in the root container can not have a name containing a forward slash (/).');
+        }
+
+        return $this->getBlobInstance($containerName, $blobName, $snapshotId, $leaseId);
+    }
+
+    /**
+     * Delete blob
+     *
+     * @param string $containerName      Container name
+     * @param string $blobName           Blob name
+     * @param string $snapshotId         Snapshot identifier
+     * @param string $leaseId            Lease identifier
+     * @param array  $additionalHeaders  Additional headers. See http://msdn.microsoft.com/en-us/library/dd179371.aspx for more information.
+     * @throws Zend_Service_WindowsAzure_Exception
+     */
+    public function deleteBlob($containerName = '', $blobName = '', $snapshotId = null, $leaseId = null, $additionalHeaders = array())
+    {
+        if ($containerName === '') {
+            throw new Zend_Service_WindowsAzure_Exception('Container name is not specified.');
+        }
+        if (!self::isValidContainerName($containerName)) {
+            throw new Zend_Service_WindowsAzure_Exception('Container name does not adhere to container naming conventions. See http://msdn.microsoft.com/en-us/library/dd135715.aspx for more information.');
+        }
+        if ($blobName === '') {
+            throw new Zend_Service_WindowsAzure_Exception('Blob name is not specified.');
+        }
+        if ($containerName === '$root' && strpos($blobName, '/') !== false) {
+            throw new Zend_Service_WindowsAzure_Exception('Blobs stored in the root container can not have a name containing a forward slash (/).');
+        }
+
+        // Build query string
+        $queryString = array();
+        if ($snapshotId !== null) {
+            $queryString[] = 'snapshot=' . $snapshotId;
+        }
+        $queryString = self::createQueryStringFromArray($queryString);
+            
+        // Additional headers?
+        $headers = array();
+        if ($leaseId !== null) {
+            $headers['x-ms-lease-id'] = $leaseId;
+        }
+        foreach ($additionalHeaders as $key => $value) {
+            $headers[$key] = $value;
+        }
+
+        // Resource name
+        $resourceName = self::createResourceName($containerName , $blobName);
+
+        // Perform request
+        $response = $this->_performRequest($resourceName, $queryString, Zend_Http_Client::DELETE, $headers, false, null, Zend_Service_WindowsAzure_Storage::RESOURCE_BLOB, Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PERMISSION_WRITE);
+        if (!$response->isSuccessful()) {
+            throw new Zend_Service_WindowsAzure_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
+        }
+    }
+
+    /**
+     * Snapshot blob
+     *
+     * @param string $containerName      Container name
+     * @param string $blobName           Blob name
+     * @param array  $metadata           Key/value pairs of meta data
+     * @param array  $additionalHeaders  Additional headers. See http://msdn.microsoft.com/en-us/library/dd179371.aspx for more information.
+     * @return string Date/Time value representing the snapshot identifier.
+     * @throws Zend_Service_WindowsAzure_Exception
+     */
+    public function snapshotBlob($containerName = '', $blobName = '', $metadata = array(), $additionalHeaders = array())
+    {
+        if ($containerName === '') {
+            throw new Zend_Service_WindowsAzure_Exception('Container name is not specified.');
+        }
+        if (!self::isValidContainerName($containerName)) {
+            throw new Zend_Service_WindowsAzure_Exception('Container name does not adhere to container naming conventions. See http://msdn.microsoft.com/en-us/library/dd135715.aspx for more information.');
+        }
+        if ($blobName === '') {
+            throw new Zend_Service_WindowsAzure_Exception('Blob name is not specified.');
+        }
+        if ($containerName === '$root' && strpos($blobName, '/') !== false) {
+            throw new Zend_Service_WindowsAzure_Exception('Blobs stored in the root container can not have a name containing a forward slash (/).');
+        }
+
+        // Additional headers?
+        $headers = array();
+        foreach ($additionalHeaders as $key => $value) {
+            $headers[$key] = $value;
+        }
+
+        // Resource name
+        $resourceName = self::createResourceName($containerName , $blobName);
+
+        // Perform request
+        $response = $this->_performRequest($resourceName, '?comp=snapshot', Zend_Http_Client::PUT, $headers, false, null, Zend_Service_WindowsAzure_Storage::RESOURCE_BLOB, Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PERMISSION_WRITE);
+        if ($response->isSuccessful()) {
+            return $response->getHeader('x-ms-snapshot');
+        } else {
+            throw new Zend_Service_WindowsAzure_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
+        }
+    }
+
+    /**
+     * Lease blob - See (http://msdn.microsoft.com/en-us/library/ee691972.aspx)
+     *
+     * @param string $containerName      Container name
+     * @param string $blobName           Blob name
+     * @param string $leaseAction        Lease action (Zend_Service_WindowsAzure_Storage_Blob::LEASE_*)
+     * @param string $leaseId            Lease identifier, required to renew the lease or to release the lease.
+     * @return Zend_Service_WindowsAzure_Storage_LeaseInstance Lease instance
+     * @throws Zend_Service_WindowsAzure_Exception
+     */
+    public function leaseBlob($containerName = '', $blobName = '', $leaseAction = self::LEASE_ACQUIRE, $leaseId = null)
+    {
+        if ($containerName === '') {
+            throw new Zend_Service_WindowsAzure_Exception('Container name is not specified.');
+        }
+        if (!self::isValidContainerName($containerName)) {
+            throw new Zend_Service_WindowsAzure_Exception('Container name does not adhere to container naming conventions. See http://msdn.microsoft.com/en-us/library/dd135715.aspx for more information.');
+        }
+        if ($blobName === '') {
+            throw new Zend_Service_WindowsAzure_Exception('Blob name is not specified.');
+        }
+        if ($containerName === '$root' && strpos($blobName, '/') !== false) {
+            throw new Zend_Service_WindowsAzure_Exception('Blobs stored in the root container can not have a name containing a forward slash (/).');
+        }
+
+        // Additional headers?
+        $headers = array();
+        $headers['x-ms-lease-action'] = strtolower($leaseAction);
+        if ($leaseId !== null) {
+            $headers['x-ms-lease-id'] = $leaseId;
+        }
+
+        // Resource name
+        $resourceName = self::createResourceName($containerName , $blobName);
+
+        // Perform request
+        $response = $this->_performRequest($resourceName, '?comp=lease', Zend_Http_Client::PUT, $headers, false, null, Zend_Service_WindowsAzure_Storage::RESOURCE_BLOB, Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PERMISSION_WRITE);
+        if ($response->isSuccessful()) {
+            return new Zend_Service_WindowsAzure_Storage_LeaseInstance(
+            $containerName,
+            $blobName,
+            $response->getHeader('x-ms-lease-id'),
+            $response->getHeader('x-ms-lease-time'));
+        } else {
+            throw new Zend_Service_WindowsAzure_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
+        }
+    }
+
+    /**
+     * List blobs
+     *
+     * @param string $containerName Container name
+     * @param string $prefix     Optional. Filters the results to return only blobs whose name begins with the specified prefix.
+     * @param string $delimiter  Optional. Delimiter, i.e. '/', for specifying folder hierarchy
+     * @param int    $maxResults Optional. Specifies the maximum number of blobs to return per call to Azure storage. This does NOT affect list size returned by this function. (maximum: 5000)
+     * @param string $marker     Optional string value that identifies the portion of the list to be returned with the next list operation.
+     * @param string $include    Optional. Specifies that the response should include one or more of the following subsets: '', 'metadata', 'snapshots', 'uncommittedblobs'). Multiple values can be added separated with a comma (,)
+     * @param int    $currentResultCount Current result count (internal use)
+     * @return array
+     * @throws Zend_Service_WindowsAzure_Exception
+     */
+    public function listBlobs($containerName = '', $prefix = '', $delimiter = '', $maxResults = null, $marker = null, $include = null, $currentResultCount = 0)
+    {
+        if ($containerName === '') {
+            throw new Zend_Service_WindowsAzure_Exception('Container name is not specified.');
+        }
+        if (!self::isValidContainerName($containerName)) {
+            throw new Zend_Service_WindowsAzure_Exception('Container name does not adhere to container naming conventions. See http://msdn.microsoft.com/en-us/library/dd135715.aspx for more information.');
+        }
+            
+        // Build query string
+        $queryString = array('restype=container', 'comp=list');
+        if ($prefix !== null) {
+            $queryString[] = 'prefix=' . $prefix;
+        }
+        if ($delimiter !== '') {
+            $queryString[] = 'delimiter=' . $delimiter;
+        }
+        if ($maxResults !== null) {
+            $queryString[] = 'maxresults=' . $maxResults;
+        }
+        if ($marker !== null) {
+            $queryString[] = 'marker=' . $marker;
+        }
+        if ($include !== null) {
+            $queryString[] = 'include=' . $include;
+        }
+        $queryString = self::createQueryStringFromArray($queryString);
+
+        // Perform request
+        $response = $this->_performRequest($containerName, $queryString, Zend_Http_Client::GET, array(), false, null, Zend_Service_WindowsAzure_Storage::RESOURCE_BLOB, Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PERMISSION_LIST);
+        if ($response->isSuccessful()) {
+            // Return value
+            $blobs = array();
+
+            // Blobs
+            $xmlBlobs = $this->_parseResponse($response)->Blobs->Blob;
+            if ($xmlBlobs !== null) {
+                for ($i = 0; $i < count($xmlBlobs); $i++) {
+                    $properties = (array)$xmlBlobs[$i]->Properties;
+                        
+                    $blobs[] = new Zend_Service_WindowsAzure_Storage_BlobInstance(
+                    $containerName,
+                    (string)$xmlBlobs[$i]->Name,
+                    (string)$xmlBlobs[$i]->Snapshot,
+                    (string)$properties['Etag'],
+                    (string)$properties['Last-Modified'],
+                    (string)$xmlBlobs[$i]->Url,
+                    (string)$properties['Content-Length'],
+                    (string)$properties['Content-Type'],
+                    (string)$properties['Content-Encoding'],
+                    (string)$properties['Content-Language'],
+                    (string)$properties['Cache-Control'],
+                    (string)$properties['BlobType'],
+                    (string)$properties['LeaseStatus'],
+                    false,
+                    $this->_parseMetadataElement($xmlBlobs[$i])
+                    );
+                }
+            }
+                
+            // Blob prefixes (folders)
+            $xmlBlobs = $this->_parseResponse($response)->Blobs->BlobPrefix;
+                
+            if ($xmlBlobs !== null) {
+                for ($i = 0; $i < count($xmlBlobs); $i++) {
+                    $blobs[] = new Zend_Service_WindowsAzure_Storage_BlobInstance(
+                    $containerName,
+                    (string)$xmlBlobs[$i]->Name,
+                    null,
+                        '',
+                        '',
+                        '',
+                    0,
+                        '',
+                        '',
+                        '',
+                        '',
+                        '',
+                        '',
+                    true,
+                    $this->_parseMetadataElement($xmlBlobs[$i])
+                    );
+                }
+            }
+                
+            // More blobs?
+            $xmlMarker = (string)$this->_parseResponse($response)->NextMarker;
+            $currentResultCount = $currentResultCount + count($blobs);
+            if ($maxResults !== null && $currentResultCount < $maxResults) {
+                if ($xmlMarker !== null && $xmlMarker != '') {
+                    $blobs = array_merge($blobs, $this->listBlobs($containerName, $prefix, $delimiter, $maxResults, $marker, $include, $currentResultCount));
+                }
+            }
+            if ($maxResults !== null && count($blobs) > $maxResults) {
+                $blobs = array_slice($blobs, 0, $maxResults);
+            }
+                
+            return $blobs;
+        } else {
+            throw new Zend_Service_WindowsAzure_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
+        }
+    }
+
+    /**
+     * Generate shared access URL
+     *
+     * @param string $containerName  Container name
+     * @param string $blobName       Blob name
+     * @param string $resource       Signed resource - container (c) - blob (b)
+     * @param string $permissions    Signed permissions - read (r), write (w), delete (d) and list (l)
+     * @param string $start          The time at which the Shared Access Signature becomes valid.
+     * @param string $expiry         The time at which the Shared Access Signature becomes invalid.
+     * @param string $identifier     Signed identifier
+     * @return string
+     */
+    public function generateSharedAccessUrl($containerName = '', $blobName = '', $resource = 'b', $permissions = 'r', $start = '', $expiry = '', $identifier = '')
+    {
+        if ($containerName === '') {
+            throw new Zend_Service_WindowsAzure_Exception('Container name is not specified.');
+        }
+        if (!self::isValidContainerName($containerName)) {
+            throw new Zend_Service_WindowsAzure_Exception('Container name does not adhere to container naming conventions. See http://msdn.microsoft.com/en-us/library/dd135715.aspx for more information.');
+        }
+
+        // Resource name
+        $resourceName = self::createResourceName($containerName , $blobName);
+
+        // Generate URL
+        return $this->getBaseUrl() . '/' . $resourceName . '?' .
+        $this->_sharedAccessSignatureCredentials->createSignedQueryString(
+        $resourceName,
+                '',
+        $resource,
+        $permissions,
+        $start,
+        $expiry,
+        $identifier);
+    }
+
+    /**
+     * Register this object as stream wrapper client
+     *
+     * @param  string $name Protocol name
+     * @return Zend_Service_WindowsAzure_Storage_Blob
+     */
+    public function registerAsClient($name)
+    {
+        self::$_wrapperClients[$name] = $this;
+        return $this;
+    }
+
+    /**
+     * Unregister this object as stream wrapper client
+     *
+     * @param  string $name Protocol name
+     * @return Zend_Service_WindowsAzure_Storage_Blob
+     */
+    public function unregisterAsClient($name)
+    {
+        unset(self::$_wrapperClients[$name]);
+        return $this;
+    }
+
+    /**
+     * Get wrapper client for stream type
+     *
+     * @param  string $name Protocol name
+     * @return Zend_Service_WindowsAzure_Storage_Blob
+     */
+    public static function getWrapperClient($name)
+    {
+        return self::$_wrapperClients[$name];
+    }
+
+    /**
+     * Register this object as stream wrapper
+     *
+     * @param  string $name Protocol name
+     */
+    public function registerStreamWrapper($name = 'azure')
+    {
+        /**
+         * @see Zend_Service_WindowsAzure_Storage_Blob_Stream
+         */
+        require_once 'Zend/Service/WindowsAzure/Storage/Blob/Stream.php';
+
+        stream_register_wrapper($name, 'Zend_Service_WindowsAzure_Storage_Blob_Stream');
+        $this->registerAsClient($name);
+    }
+
+    /**
+     * Unregister this object as stream wrapper
+     *
+     * @param  string $name Protocol name
+     * @return Zend_Service_WindowsAzure_Storage_Blob
+     */
+    public function unregisterStreamWrapper($name = 'azure')
+    {
+        stream_wrapper_unregister($name);
+        $this->unregisterAsClient($name);
+    }
+
+    /**
+     * Create resource name
+     *
+     * @param string $containerName  Container name
+     * @param string $blobName Blob name
+     * @return string
+     */
+    public static function createResourceName($containerName = '', $blobName = '')
+    {
+        // Resource name
+        $resourceName = $containerName . '/' . $blobName;
+        if ($containerName === '' || $containerName === '$root') {
+            $resourceName = $blobName;
+        }
+        if ($blobName === '') {
+            $resourceName = $containerName;
+        }
+
+        return $resourceName;
+    }
+
+    /**
+     * Is valid container name?
+     *
+     * @param string $containerName Container name
+     * @return boolean
+     */
+    public static function isValidContainerName($containerName = '')
+    {
+        if ($containerName == '$root') {
+            return true;
+        }
+
+        if (preg_match("/^[a-z0-9][a-z0-9-]*$/", $containerName) === 0) {
+            return false;
+        }
+
+        if (strpos($containerName, '--') !== false) {
+            return false;
+        }
+
+        if (strtolower($containerName) != $containerName) {
+            return false;
+        }
+
+        if (strlen($containerName) < 3 || strlen($containerName) > 63) {
+            return false;
+        }
+
+        if (substr($containerName, -1) == '-') {
+            return false;
+        }
+
+        return true;
+    }
+
+    /**
+     * Get error message from Zend_Http_Response
+     *
+     * @param Zend_Http_Response $response Repsonse
+     * @param string $alternativeError Alternative error message
+     * @return string
+     */
+    protected function _getErrorMessage(Zend_Http_Response $response, $alternativeError = 'Unknown error.')
+    {
+        $response = $this->_parseResponse($response);
+        if ($response && $response->Message) {
+            return (string)$response->Message;
+        } else {
+            return $alternativeError;
+        }
+    }
+
+    /**
+     * Generate block id
+     *
+     * @param int $part Block number
+     * @return string Windows Azure Blob Storage block number
+     */
+    protected function _generateBlockId($part = 0)
+    {
+        $returnValue = $part;
+        while (strlen($returnValue) < 64) {
+            $returnValue = '0' . $returnValue;
+        }
+
+        return $returnValue;
+    }
 }

+ 4 - 4
library/Zend/Service/WindowsAzure/Storage/Blob/Stream.php

@@ -132,9 +132,9 @@ class Zend_Service_WindowsAzure_Storage_Blob_Stream
         $url = parse_url($path);
         if ($url['host']) {
             $fileName = isset($url['path']) ? $url['path'] : $url['host'];
-    	    if (strpos($fileName, '/') === 0) {
-    	        $fileName = substr($fileName, 1);
-    	    }
+            if (strpos($fileName, '/') === 0) {
+                $fileName = substr($fileName, 1);
+            }
             return $fileName;
         }
 
@@ -165,7 +165,7 @@ class Zend_Service_WindowsAzure_Storage_Blob_Stream
         // Write mode?
         if (strpbrk($mode, 'wax+')) {
             $this->_writeMode = true;
-    	} else {
+        } else {
             $this->_writeMode = false;
         }
 

+ 2 - 2
library/Zend/Service/WindowsAzure/Storage/BlobInstance.php

@@ -82,11 +82,11 @@ class Zend_Service_WindowsAzure_Storage_BlobInstance
      * @param array   $metadata        Key/value pairs of meta data
      */
     public function __construct($containerName, $name, $snapshotId, $etag, $lastModified, $url = '', $size = 0, $contentType = '', $contentEncoding = '', $contentLanguage = '', $cacheControl = '', $blobType = '', $leaseStatus = '', $isPrefix = false, $metadata = array())
-    {	
+    {    
         $this->_data = array(
             'container'        => $containerName,
             'name'             => $name,
-        	'snapshotid'	   => $snapshotId,
+            'snapshotid'       => $snapshotId,
             'etag'             => $etag,
             'lastmodified'     => $lastModified,
             'url'              => $url,

+ 2 - 2
library/Zend/Service/WindowsAzure/Storage/DynamicTableEntity.php

@@ -100,8 +100,8 @@ class Zend_Service_WindowsAzure_Storage_DynamicTableEntity extends Zend_Service_
                 // Set dynamic property
                 $this->_dynamicProperties[strtolower($name)] = (object)array(
                         'Name'  => $name,
-                    	'Type'  => $type,
-                    	'Value' => $value,
+                        'Type'  => $type,
+                        'Value' => $value,
                     );
             }
 

+ 3 - 3
library/Zend/Service/WindowsAzure/Storage/LeaseInstance.php

@@ -43,7 +43,7 @@ require_once 'Zend/Service/WindowsAzure/Storage/StorageEntityAbstract.php';
  * @property string  $LeaseTime       Time remaining in the lease period, in seconds. This header is returned only for a successful request to break the lease. It provides an approximation as to when the lease period will expire.
  */
 class Zend_Service_WindowsAzure_Storage_LeaseInstance
-	extends Zend_Service_WindowsAzure_Storage_StorageEntityAbstract
+    extends Zend_Service_WindowsAzure_Storage_StorageEntityAbstract
 {
     /**
      * Constructor
@@ -54,11 +54,11 @@ class Zend_Service_WindowsAzure_Storage_LeaseInstance
      * @param string  $leaseTime       Time remaining in the lease period, in seconds. This header is returned only for a successful request to break the lease. It provides an approximation as to when the lease period will expire.
      */
     public function __construct($containerName, $name, $leaseId, $leaseTime)
-    {	
+    {    
         $this->_data = array(
             'container'        => $containerName,
             'name'             => $name,
-        	'leaseid'          => $leaseId,
+            'leaseid'          => $leaseId,
             'leasetime'        => $leaseTime
         );
     }

+ 2 - 2
library/Zend/Service/WindowsAzure/Storage/PageRegionInstance.php

@@ -41,7 +41,7 @@ require_once 'Zend/Service/WindowsAzure/Storage/StorageEntityAbstract.php';
  * @property int  $end     Page range end
  */
 class Zend_Service_WindowsAzure_Storage_PageRegionInstance
-	extends Zend_Service_WindowsAzure_Storage_StorageEntityAbstract
+    extends Zend_Service_WindowsAzure_Storage_StorageEntityAbstract
 {
     /**
      * Constructor
@@ -50,7 +50,7 @@ class Zend_Service_WindowsAzure_Storage_PageRegionInstance
      * @param int  $end     Page range end
      */
     public function __construct($start = 0, $end = 0)
-    {	
+    {    
         $this->_data = array(
             'start'        => $start,
             'end'             => $end

+ 439 - 439
library/Zend/Service/WindowsAzure/Storage/Queue.php

@@ -70,49 +70,49 @@ require_once 'Zend/Service/WindowsAzure/Exception.php';
  */
 class Zend_Service_WindowsAzure_Storage_Queue extends Zend_Service_WindowsAzure_Storage
 {
-	/**
-	 * Maximal message size (in bytes)
-	 */
-	const MAX_MESSAGE_SIZE = 8388608;
-	
-	/**
-	 * Maximal message ttl (in seconds)
-	 */
-	const MAX_MESSAGE_TTL = 604800;
-	
-	/**
-	 * Creates a new Zend_Service_WindowsAzure_Storage_Queue instance
-	 *
-	 * @param string $host Storage host name
-	 * @param string $accountName Account name for Windows Azure
-	 * @param string $accountKey Account key for Windows Azure
-	 * @param boolean $usePathStyleUri Use path-style URI's
-	 * @param Zend_Service_WindowsAzure_RetryPolicy_RetryPolicyAbstract $retryPolicy Retry policy to use when making requests
-	 */
-	public function __construct($host = Zend_Service_WindowsAzure_Storage::URL_DEV_QUEUE, $accountName = Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::DEVSTORE_ACCOUNT, $accountKey = Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::DEVSTORE_KEY, $usePathStyleUri = false, Zend_Service_WindowsAzure_RetryPolicy_RetryPolicyAbstract $retryPolicy = null)
-	{
-		parent::__construct($host, $accountName, $accountKey, $usePathStyleUri, $retryPolicy);
-		
-		// API version
-		$this->_apiVersion = '2009-09-19';
-	}
-	
-	/**
-	 * Check if a queue exists
-	 *
-	 * @param string $queueName Queue name
-	 * @return boolean
-	 */
-	public function queueExists($queueName = '')
-	{
-		if ($queueName === '') {
-			throw new Zend_Service_WindowsAzure_Exception('Queue name is not specified.');
-		}
-		if (!self::isValidQueueName($queueName)) {
-		    throw new Zend_Service_WindowsAzure_Exception('Queue name does not adhere to queue naming conventions. See http://msdn.microsoft.com/en-us/library/dd179349.aspx for more information.');
-		}
-			
-		// List queues
+    /**
+     * Maximal message size (in bytes)
+     */
+    const MAX_MESSAGE_SIZE = 8388608;
+    
+    /**
+     * Maximal message ttl (in seconds)
+     */
+    const MAX_MESSAGE_TTL = 604800;
+    
+    /**
+     * Creates a new Zend_Service_WindowsAzure_Storage_Queue instance
+     *
+     * @param string $host Storage host name
+     * @param string $accountName Account name for Windows Azure
+     * @param string $accountKey Account key for Windows Azure
+     * @param boolean $usePathStyleUri Use path-style URI's
+     * @param Zend_Service_WindowsAzure_RetryPolicy_RetryPolicyAbstract $retryPolicy Retry policy to use when making requests
+     */
+    public function __construct($host = Zend_Service_WindowsAzure_Storage::URL_DEV_QUEUE, $accountName = Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::DEVSTORE_ACCOUNT, $accountKey = Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::DEVSTORE_KEY, $usePathStyleUri = false, Zend_Service_WindowsAzure_RetryPolicy_RetryPolicyAbstract $retryPolicy = null)
+    {
+        parent::__construct($host, $accountName, $accountKey, $usePathStyleUri, $retryPolicy);
+        
+        // API version
+        $this->_apiVersion = '2009-09-19';
+    }
+    
+    /**
+     * Check if a queue exists
+     *
+     * @param string $queueName Queue name
+     * @return boolean
+     */
+    public function queueExists($queueName = '')
+    {
+        if ($queueName === '') {
+            throw new Zend_Service_WindowsAzure_Exception('Queue name is not specified.');
+        }
+        if (!self::isValidQueueName($queueName)) {
+            throw new Zend_Service_WindowsAzure_Exception('Queue name does not adhere to queue naming conventions. See http://msdn.microsoft.com/en-us/library/dd179349.aspx for more information.');
+        }
+            
+        // List queues
         $queues = $this->listQueues($queueName, 1);
         foreach ($queues as $queue) {
             if ($queue->Name == $queueName) {
@@ -121,396 +121,396 @@ class Zend_Service_WindowsAzure_Storage_Queue extends Zend_Service_WindowsAzure_
         }
 
         return false;
-	}
-	
-	/**
-	 * Create queue
-	 *
-	 * @param string $queueName Queue name
-	 * @param array  $metadata  Key/value pairs of meta data
-	 * @return object Queue properties
-	 * @throws Zend_Service_WindowsAzure_Exception
-	 */
-	public function createQueue($queueName = '', $metadata = array())
-	{
-		if ($queueName === '') {
-			throw new Zend_Service_WindowsAzure_Exception('Queue name is not specified.');
-		}
-		if (!self::isValidQueueName($queueName)) {
-		    throw new Zend_Service_WindowsAzure_Exception('Queue name does not adhere to queue naming conventions. See http://msdn.microsoft.com/en-us/library/dd179349.aspx for more information.');
-		}
-			
-		// Create metadata headers
-		$headers = array();
-		$headers = array_merge($headers, $this->_generateMetadataHeaders($metadata));
-		
-		// Perform request
-		$response = $this->_performRequest($queueName, '', Zend_Http_Client::PUT, $headers);	
-		if ($response->isSuccessful()) {
-		    return new Zend_Service_WindowsAzure_Storage_QueueInstance(
-		        $queueName,
-		        $metadata
-		    );
-		} else {
-			throw new Zend_Service_WindowsAzure_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
-		}
-	}
-	
-	/**
-	 * Get queue
-	 *
-	 * @param string $queueName  Queue name
-	 * @return Zend_Service_WindowsAzure_Storage_QueueInstance
-	 * @throws Zend_Service_WindowsAzure_Exception
-	 */
-	public function getQueue($queueName = '')
-	{
-		if ($queueName === '') {
-			throw new Zend_Service_WindowsAzure_Exception('Queue name is not specified.');
-		}
-		if (!self::isValidQueueName($queueName)) {
-		    throw new Zend_Service_WindowsAzure_Exception('Queue name does not adhere to queue naming conventions. See http://msdn.microsoft.com/en-us/library/dd179349.aspx for more information.');
-		}
-		
-		// Perform request
-		$response = $this->_performRequest($queueName, '?comp=metadata', Zend_Http_Client::GET);	
-		if ($response->isSuccessful()) {
-		    // Parse metadata
-		    $metadata = $this->_parseMetadataHeaders($response->getHeaders());
+    }
+    
+    /**
+     * Create queue
+     *
+     * @param string $queueName Queue name
+     * @param array  $metadata  Key/value pairs of meta data
+     * @return object Queue properties
+     * @throws Zend_Service_WindowsAzure_Exception
+     */
+    public function createQueue($queueName = '', $metadata = array())
+    {
+        if ($queueName === '') {
+            throw new Zend_Service_WindowsAzure_Exception('Queue name is not specified.');
+        }
+        if (!self::isValidQueueName($queueName)) {
+            throw new Zend_Service_WindowsAzure_Exception('Queue name does not adhere to queue naming conventions. See http://msdn.microsoft.com/en-us/library/dd179349.aspx for more information.');
+        }
+            
+        // Create metadata headers
+        $headers = array();
+        $headers = array_merge($headers, $this->_generateMetadataHeaders($metadata));
+        
+        // Perform request
+        $response = $this->_performRequest($queueName, '', Zend_Http_Client::PUT, $headers);    
+        if ($response->isSuccessful()) {
+            return new Zend_Service_WindowsAzure_Storage_QueueInstance(
+                $queueName,
+                $metadata
+            );
+        } else {
+            throw new Zend_Service_WindowsAzure_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
+        }
+    }
+    
+    /**
+     * Get queue
+     *
+     * @param string $queueName  Queue name
+     * @return Zend_Service_WindowsAzure_Storage_QueueInstance
+     * @throws Zend_Service_WindowsAzure_Exception
+     */
+    public function getQueue($queueName = '')
+    {
+        if ($queueName === '') {
+            throw new Zend_Service_WindowsAzure_Exception('Queue name is not specified.');
+        }
+        if (!self::isValidQueueName($queueName)) {
+            throw new Zend_Service_WindowsAzure_Exception('Queue name does not adhere to queue naming conventions. See http://msdn.microsoft.com/en-us/library/dd179349.aspx for more information.');
+        }
+        
+        // Perform request
+        $response = $this->_performRequest($queueName, '?comp=metadata', Zend_Http_Client::GET);    
+        if ($response->isSuccessful()) {
+            // Parse metadata
+            $metadata = $this->_parseMetadataHeaders($response->getHeaders());
 
-		    // Return queue
-		    $queue = new Zend_Service_WindowsAzure_Storage_QueueInstance(
-		        $queueName,
-		        $metadata
-		    );
-		    $queue->ApproximateMessageCount = intval($response->getHeader('x-ms-approximate-message-count'));
-		    return $queue;
-		} else {
-		    throw new Zend_Service_WindowsAzure_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
-		}
-	}
-	
-	/**
-	 * Get queue metadata
-	 *
-	 * @param string $queueName  Queue name
-	 * @return array Key/value pairs of meta data
-	 * @throws Zend_Service_WindowsAzure_Exception
-	 */
-	public function getQueueMetadata($queueName = '')
-	{
-		if ($queueName === '') {
-			throw new Zend_Service_WindowsAzure_Exception('Queue name is not specified.');
-		}
-		if (!self::isValidQueueName($queueName)) {
-		    throw new Zend_Service_WindowsAzure_Exception('Queue name does not adhere to queue naming conventions. See http://msdn.microsoft.com/en-us/library/dd179349.aspx for more information.');
-		}
-			
-	    return $this->getQueue($queueName)->Metadata;
-	}
-	
-	/**
-	 * Set queue metadata
-	 *
-	 * Calling the Set Queue Metadata operation overwrites all existing metadata that is associated with the queue. It's not possible to modify an individual name/value pair.
-	 *
-	 * @param string $queueName  Queue name
-	 * @param array  $metadata       Key/value pairs of meta data
-	 * @throws Zend_Service_WindowsAzure_Exception
-	 */
-	public function setQueueMetadata($queueName = '', $metadata = array())
-	{
-		if ($queueName === '') {
-			throw new Zend_Service_WindowsAzure_Exception('Queue name is not specified.');
-		}
-		if (!self::isValidQueueName($queueName)) {
-		    throw new Zend_Service_WindowsAzure_Exception('Queue name does not adhere to queue naming conventions. See http://msdn.microsoft.com/en-us/library/dd179349.aspx for more information.');
-		}
-		if (count($metadata) == 0) {
-		    return;
-		}
-		
-		// Create metadata headers
-		$headers = array();
-		$headers = array_merge($headers, $this->_generateMetadataHeaders($metadata));
-		
-		// Perform request
-		$response = $this->_performRequest($queueName, '?comp=metadata', Zend_Http_Client::PUT, $headers);
+            // Return queue
+            $queue = new Zend_Service_WindowsAzure_Storage_QueueInstance(
+                $queueName,
+                $metadata
+            );
+            $queue->ApproximateMessageCount = intval($response->getHeader('x-ms-approximate-message-count'));
+            return $queue;
+        } else {
+            throw new Zend_Service_WindowsAzure_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
+        }
+    }
+    
+    /**
+     * Get queue metadata
+     *
+     * @param string $queueName  Queue name
+     * @return array Key/value pairs of meta data
+     * @throws Zend_Service_WindowsAzure_Exception
+     */
+    public function getQueueMetadata($queueName = '')
+    {
+        if ($queueName === '') {
+            throw new Zend_Service_WindowsAzure_Exception('Queue name is not specified.');
+        }
+        if (!self::isValidQueueName($queueName)) {
+            throw new Zend_Service_WindowsAzure_Exception('Queue name does not adhere to queue naming conventions. See http://msdn.microsoft.com/en-us/library/dd179349.aspx for more information.');
+        }
+            
+        return $this->getQueue($queueName)->Metadata;
+    }
+    
+    /**
+     * Set queue metadata
+     *
+     * Calling the Set Queue Metadata operation overwrites all existing metadata that is associated with the queue. It's not possible to modify an individual name/value pair.
+     *
+     * @param string $queueName  Queue name
+     * @param array  $metadata       Key/value pairs of meta data
+     * @throws Zend_Service_WindowsAzure_Exception
+     */
+    public function setQueueMetadata($queueName = '', $metadata = array())
+    {
+        if ($queueName === '') {
+            throw new Zend_Service_WindowsAzure_Exception('Queue name is not specified.');
+        }
+        if (!self::isValidQueueName($queueName)) {
+            throw new Zend_Service_WindowsAzure_Exception('Queue name does not adhere to queue naming conventions. See http://msdn.microsoft.com/en-us/library/dd179349.aspx for more information.');
+        }
+        if (count($metadata) == 0) {
+            return;
+        }
+        
+        // Create metadata headers
+        $headers = array();
+        $headers = array_merge($headers, $this->_generateMetadataHeaders($metadata));
+        
+        // Perform request
+        $response = $this->_performRequest($queueName, '?comp=metadata', Zend_Http_Client::PUT, $headers);
 
-		if (!$response->isSuccessful()) {
-			throw new Zend_Service_WindowsAzure_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
-		}
-	}
-	
-	/**
-	 * Delete queue
-	 *
-	 * @param string $queueName Queue name
-	 * @throws Zend_Service_WindowsAzure_Exception
-	 */
-	public function deleteQueue($queueName = '')
-	{
-		if ($queueName === '') {
-			throw new Zend_Service_WindowsAzure_Exception('Queue name is not specified.');
-		}
-		if (!self::isValidQueueName($queueName)) {
-		    throw new Zend_Service_WindowsAzure_Exception('Queue name does not adhere to queue naming conventions. See http://msdn.microsoft.com/en-us/library/dd179349.aspx for more information.');
-		}
-			
-		// Perform request
-		$response = $this->_performRequest($queueName, '', Zend_Http_Client::DELETE);
-		if (!$response->isSuccessful()) {
-			throw new Zend_Service_WindowsAzure_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
-		}
-	}
-	
-	/**
-	 * List queues
-	 *
-	 * @param string $prefix     Optional. Filters the results to return only queues whose name begins with the specified prefix.
-	 * @param int    $maxResults Optional. Specifies the maximum number of queues to return per call to Azure storage. This does NOT affect list size returned by this function. (maximum: 5000)
-	 * @param string $marker     Optional string value that identifies the portion of the list to be returned with the next list operation.
-	 * @param string $include    Optional. Include this parameter to specify that the queue's metadata be returned as part of the response body. (allowed values: '', 'metadata')
-	 * @param int    $currentResultCount Current result count (internal use)
-	 * @return array
-	 * @throws Zend_Service_WindowsAzure_Exception
-	 */
-	public function listQueues($prefix = null, $maxResults = null, $marker = null, $include = null, $currentResultCount = 0)
-	{
-	    // Build query string
-		$queryString = array('comp=list');
+        if (!$response->isSuccessful()) {
+            throw new Zend_Service_WindowsAzure_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
+        }
+    }
+    
+    /**
+     * Delete queue
+     *
+     * @param string $queueName Queue name
+     * @throws Zend_Service_WindowsAzure_Exception
+     */
+    public function deleteQueue($queueName = '')
+    {
+        if ($queueName === '') {
+            throw new Zend_Service_WindowsAzure_Exception('Queue name is not specified.');
+        }
+        if (!self::isValidQueueName($queueName)) {
+            throw new Zend_Service_WindowsAzure_Exception('Queue name does not adhere to queue naming conventions. See http://msdn.microsoft.com/en-us/library/dd179349.aspx for more information.');
+        }
+            
+        // Perform request
+        $response = $this->_performRequest($queueName, '', Zend_Http_Client::DELETE);
+        if (!$response->isSuccessful()) {
+            throw new Zend_Service_WindowsAzure_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
+        }
+    }
+    
+    /**
+     * List queues
+     *
+     * @param string $prefix     Optional. Filters the results to return only queues whose name begins with the specified prefix.
+     * @param int    $maxResults Optional. Specifies the maximum number of queues to return per call to Azure storage. This does NOT affect list size returned by this function. (maximum: 5000)
+     * @param string $marker     Optional string value that identifies the portion of the list to be returned with the next list operation.
+     * @param string $include    Optional. Include this parameter to specify that the queue's metadata be returned as part of the response body. (allowed values: '', 'metadata')
+     * @param int    $currentResultCount Current result count (internal use)
+     * @return array
+     * @throws Zend_Service_WindowsAzure_Exception
+     */
+    public function listQueues($prefix = null, $maxResults = null, $marker = null, $include = null, $currentResultCount = 0)
+    {
+        // Build query string
+        $queryString = array('comp=list');
         if ($prefix !== null) {
-	        $queryString[] = 'prefix=' . $prefix;
-        }
-	    if ($maxResults !== null) {
-	        $queryString[] = 'maxresults=' . $maxResults;
-	    }
-	    if ($marker !== null) {
-	        $queryString[] = 'marker=' . $marker;
-	    }
-		if ($include !== null) {
-	        $queryString[] = 'include=' . $include;
-	    }
-	    $queryString = self::createQueryStringFromArray($queryString);
-	
-		// Perform request
-		$response = $this->_performRequest('', $queryString, Zend_Http_Client::GET);	
-		if ($response->isSuccessful()) {
-			$xmlQueues = $this->_parseResponse($response)->Queues->Queue;
-			$xmlMarker = (string)$this->_parseResponse($response)->NextMarker;
+            $queryString[] = 'prefix=' . $prefix;
+        }
+        if ($maxResults !== null) {
+            $queryString[] = 'maxresults=' . $maxResults;
+        }
+        if ($marker !== null) {
+            $queryString[] = 'marker=' . $marker;
+        }
+        if ($include !== null) {
+            $queryString[] = 'include=' . $include;
+        }
+        $queryString = self::createQueryStringFromArray($queryString);
+    
+        // Perform request
+        $response = $this->_performRequest('', $queryString, Zend_Http_Client::GET);    
+        if ($response->isSuccessful()) {
+            $xmlQueues = $this->_parseResponse($response)->Queues->Queue;
+            $xmlMarker = (string)$this->_parseResponse($response)->NextMarker;
 
-			$queues = array();
-			if ($xmlQueues !== null) {
-				for ($i = 0; $i < count($xmlQueues); $i++) {
-					$queues[] = new Zend_Service_WindowsAzure_Storage_QueueInstance(
-						(string)$xmlQueues[$i]->Name,
-						$this->_parseMetadataElement($xmlQueues[$i])
-					);
-				}
-			}
-			$currentResultCount = $currentResultCount + count($queues);
-			if ($maxResults !== null && $currentResultCount < $maxResults) {
-    			if ($xmlMarker !== null && $xmlMarker != '') {
-    			    $queues = array_merge($queues, $this->listQueues($prefix, $maxResults, $xmlMarker, $include, $currentResultCount));
-    			}
-			}
-			if ($maxResults !== null && count($queues) > $maxResults) {
-			    $queues = array_slice($queues, 0, $maxResults);
-			}
-			
-			return $queues;
-		} else {
-			throw new Zend_Service_WindowsAzure_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
-		}
-	}
-	
-	/**
-	 * Put message into queue
-	 *
-	 * @param string $queueName  Queue name
-	 * @param string $message    Message
-	 * @param int    $ttl        Message Time-To-Live (in seconds). Defaults to 7 days if the parameter is omitted.
-	 * @throws Zend_Service_WindowsAzure_Exception
-	 */
-	public function putMessage($queueName = '', $message = '', $ttl = null)
-	{
-		if ($queueName === '') {
-			throw new Zend_Service_WindowsAzure_Exception('Queue name is not specified.');
-		}
-		if (!self::isValidQueueName($queueName)) {
-		    throw new Zend_Service_WindowsAzure_Exception('Queue name does not adhere to queue naming conventions. See http://msdn.microsoft.com/en-us/library/dd179349.aspx for more information.');
-		}
-		if (strlen($message) > self::MAX_MESSAGE_SIZE) {
-		    throw new Zend_Service_WindowsAzure_Exception('Message is too big. Message content should be < 8KB.');
-		}
-		if ($message == '') {
-		    throw new Zend_Service_WindowsAzure_Exception('Message is not specified.');
-		}
-		if ($ttl !== null && ($ttl <= 0 || $ttl > self::MAX_MESSAGE_SIZE)) {
-		    throw new Zend_Service_WindowsAzure_Exception('Message TTL is invalid. Maximal TTL is 7 days (' . self::MAX_MESSAGE_SIZE . ' seconds) and should be greater than zero.');
-		}
-		
-	    // Build query string
-		$queryString = array();
+            $queues = array();
+            if ($xmlQueues !== null) {
+                for ($i = 0; $i < count($xmlQueues); $i++) {
+                    $queues[] = new Zend_Service_WindowsAzure_Storage_QueueInstance(
+                        (string)$xmlQueues[$i]->Name,
+                        $this->_parseMetadataElement($xmlQueues[$i])
+                    );
+                }
+            }
+            $currentResultCount = $currentResultCount + count($queues);
+            if ($maxResults !== null && $currentResultCount < $maxResults) {
+                if ($xmlMarker !== null && $xmlMarker != '') {
+                    $queues = array_merge($queues, $this->listQueues($prefix, $maxResults, $xmlMarker, $include, $currentResultCount));
+                }
+            }
+            if ($maxResults !== null && count($queues) > $maxResults) {
+                $queues = array_slice($queues, 0, $maxResults);
+            }
+            
+            return $queues;
+        } else {
+            throw new Zend_Service_WindowsAzure_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
+        }
+    }
+    
+    /**
+     * Put message into queue
+     *
+     * @param string $queueName  Queue name
+     * @param string $message    Message
+     * @param int    $ttl        Message Time-To-Live (in seconds). Defaults to 7 days if the parameter is omitted.
+     * @throws Zend_Service_WindowsAzure_Exception
+     */
+    public function putMessage($queueName = '', $message = '', $ttl = null)
+    {
+        if ($queueName === '') {
+            throw new Zend_Service_WindowsAzure_Exception('Queue name is not specified.');
+        }
+        if (!self::isValidQueueName($queueName)) {
+            throw new Zend_Service_WindowsAzure_Exception('Queue name does not adhere to queue naming conventions. See http://msdn.microsoft.com/en-us/library/dd179349.aspx for more information.');
+        }
+        if (strlen($message) > self::MAX_MESSAGE_SIZE) {
+            throw new Zend_Service_WindowsAzure_Exception('Message is too big. Message content should be < 8KB.');
+        }
+        if ($message == '') {
+            throw new Zend_Service_WindowsAzure_Exception('Message is not specified.');
+        }
+        if ($ttl !== null && ($ttl <= 0 || $ttl > self::MAX_MESSAGE_SIZE)) {
+            throw new Zend_Service_WindowsAzure_Exception('Message TTL is invalid. Maximal TTL is 7 days (' . self::MAX_MESSAGE_SIZE . ' seconds) and should be greater than zero.');
+        }
+        
+        // Build query string
+        $queryString = array();
         if ($ttl !== null) {
-	        $queryString[] = 'messagettl=' . $ttl;
-        }
-	    $queryString = self::createQueryStringFromArray($queryString);
-	
-	    // Build body
-	    $rawData = '';
-	    $rawData .= '<QueueMessage>';
-	    $rawData .= '    <MessageText>' . base64_encode($message) . '</MessageText>';
-	    $rawData .= '</QueueMessage>';
-	
-		// Perform request
-		$response = $this->_performRequest($queueName . '/messages', $queryString, Zend_Http_Client::POST, array(), false, $rawData);
+            $queryString[] = 'messagettl=' . $ttl;
+        }
+        $queryString = self::createQueryStringFromArray($queryString);
+    
+        // Build body
+        $rawData = '';
+        $rawData .= '<QueueMessage>';
+        $rawData .= '    <MessageText>' . base64_encode($message) . '</MessageText>';
+        $rawData .= '</QueueMessage>';
+    
+        // Perform request
+        $response = $this->_performRequest($queueName . '/messages', $queryString, Zend_Http_Client::POST, array(), false, $rawData);
 
-		if (!$response->isSuccessful()) {
-			throw new Zend_Service_WindowsAzure_Exception('Error putting message into queue.');
-		}
-	}
-	
-	/**
-	 * Get queue messages
-	 *
-	 * @param string $queueName         Queue name
-	 * @param string $numOfMessages     Optional. A nonzero integer value that specifies the number of messages to retrieve from the queue, up to a maximum of 32. By default, a single message is retrieved from the queue with this operation.
-	 * @param int    $visibilityTimeout Optional. An integer value that specifies the message's visibility timeout in seconds. The maximum value is 2 hours. The default message visibility timeout is 30 seconds.
-	 * @param string $peek              Peek only?
-	 * @return array
-	 * @throws Zend_Service_WindowsAzure_Exception
-	 */
-	public function getMessages($queueName = '', $numOfMessages = 1, $visibilityTimeout = null, $peek = false)
-	{
-		if ($queueName === '') {
-			throw new Zend_Service_WindowsAzure_Exception('Queue name is not specified.');
-		}
-		if (!self::isValidQueueName($queueName)) {
-		    throw new Zend_Service_WindowsAzure_Exception('Queue name does not adhere to queue naming conventions. See http://msdn.microsoft.com/en-us/library/dd179349.aspx for more information.');
-		}
-		if ($numOfMessages < 1 || $numOfMessages > 32 || intval($numOfMessages) != $numOfMessages) {
-		    throw new Zend_Service_WindowsAzure_Exception('Invalid number of messages to retrieve.');
-		}
-		if ($visibilityTimeout !== null && ($visibilityTimeout <= 0 || $visibilityTimeout > 7200)) {
-		    throw new Zend_Service_WindowsAzure_Exception('Visibility timeout is invalid. Maximum value is 2 hours (7200 seconds) and should be greater than zero.');
-		}
-		
-	    // Build query string
-		$queryString = array();
-    	if ($peek) {
-    	    $queryString[] = 'peekonly=true';
-    	}
-    	if ($numOfMessages > 1) {
-	        $queryString[] = 'numofmessages=' . $numOfMessages;
-    	}
-    	if (!$peek && $visibilityTimeout !== null) {
-	        $queryString[] = 'visibilitytimeout=' . $visibilityTimeout;
-    	}
-	    $queryString = self::createQueryStringFromArray($queryString);
-	
-		// Perform request
-		$response = $this->_performRequest($queueName . '/messages', $queryString, Zend_Http_Client::GET);	
-		if ($response->isSuccessful()) {
-		    // Parse results
-			$result = $this->_parseResponse($response);
-		    if (!$result) {
-		        return array();
-		    }
+        if (!$response->isSuccessful()) {
+            throw new Zend_Service_WindowsAzure_Exception('Error putting message into queue.');
+        }
+    }
+    
+    /**
+     * Get queue messages
+     *
+     * @param string $queueName         Queue name
+     * @param string $numOfMessages     Optional. A nonzero integer value that specifies the number of messages to retrieve from the queue, up to a maximum of 32. By default, a single message is retrieved from the queue with this operation.
+     * @param int    $visibilityTimeout Optional. An integer value that specifies the message's visibility timeout in seconds. The maximum value is 2 hours. The default message visibility timeout is 30 seconds.
+     * @param string $peek              Peek only?
+     * @return array
+     * @throws Zend_Service_WindowsAzure_Exception
+     */
+    public function getMessages($queueName = '', $numOfMessages = 1, $visibilityTimeout = null, $peek = false)
+    {
+        if ($queueName === '') {
+            throw new Zend_Service_WindowsAzure_Exception('Queue name is not specified.');
+        }
+        if (!self::isValidQueueName($queueName)) {
+            throw new Zend_Service_WindowsAzure_Exception('Queue name does not adhere to queue naming conventions. See http://msdn.microsoft.com/en-us/library/dd179349.aspx for more information.');
+        }
+        if ($numOfMessages < 1 || $numOfMessages > 32 || intval($numOfMessages) != $numOfMessages) {
+            throw new Zend_Service_WindowsAzure_Exception('Invalid number of messages to retrieve.');
+        }
+        if ($visibilityTimeout !== null && ($visibilityTimeout <= 0 || $visibilityTimeout > 7200)) {
+            throw new Zend_Service_WindowsAzure_Exception('Visibility timeout is invalid. Maximum value is 2 hours (7200 seconds) and should be greater than zero.');
+        }
+        
+        // Build query string
+        $queryString = array();
+        if ($peek) {
+            $queryString[] = 'peekonly=true';
+        }
+        if ($numOfMessages > 1) {
+            $queryString[] = 'numofmessages=' . $numOfMessages;
+        }
+        if (!$peek && $visibilityTimeout !== null) {
+            $queryString[] = 'visibilitytimeout=' . $visibilityTimeout;
+        }
+        $queryString = self::createQueryStringFromArray($queryString);
+    
+        // Perform request
+        $response = $this->_performRequest($queueName . '/messages', $queryString, Zend_Http_Client::GET);    
+        if ($response->isSuccessful()) {
+            // Parse results
+            $result = $this->_parseResponse($response);
+            if (!$result) {
+                return array();
+            }
 
-		    $xmlMessages = null;
-		    if (count($result->QueueMessage) > 1) {
-    		    $xmlMessages = $result->QueueMessage;
-    		} else {
-    		    $xmlMessages = array($result->QueueMessage);
-    		}
+            $xmlMessages = null;
+            if (count($result->QueueMessage) > 1) {
+                $xmlMessages = $result->QueueMessage;
+            } else {
+                $xmlMessages = array($result->QueueMessage);
+            }
 
-			$messages = array();
-			for ($i = 0; $i < count($xmlMessages); $i++) {
-				$messages[] = new Zend_Service_WindowsAzure_Storage_QueueMessage(
-					(string)$xmlMessages[$i]->MessageId,
-					(string)$xmlMessages[$i]->InsertionTime,
-					(string)$xmlMessages[$i]->ExpirationTime,
-					($peek ? '' : (string)$xmlMessages[$i]->PopReceipt),
-					($peek ? '' : (string)$xmlMessages[$i]->TimeNextVisible),
-					(string)$xmlMessages[$i]->DequeueCount,
-					base64_decode((string)$xmlMessages[$i]->MessageText)
-			    );
-			}
-			
-			return $messages;
-		} else {
-			throw new Zend_Service_WindowsAzure_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
-		}
-	}
-	
-	/**
-	 * Peek queue messages
-	 *
-	 * @param string $queueName         Queue name
-	 * @param string $numOfMessages     Optional. A nonzero integer value that specifies the number of messages to retrieve from the queue, up to a maximum of 32. By default, a single message is retrieved from the queue with this operation.
-	 * @return array
-	 * @throws Zend_Service_WindowsAzure_Exception
-	 */
-	public function peekMessages($queueName = '', $numOfMessages = 1)
-	{
-	    return $this->getMessages($queueName, $numOfMessages, null, true);
-	}
-	
-	/**
-	 * Clear queue messages
-	 *
-	 * @param string $queueName         Queue name
-	 * @throws Zend_Service_WindowsAzure_Exception
-	 */
-	public function clearMessages($queueName = '')
-	{
-		if ($queueName === '') {
-			throw new Zend_Service_WindowsAzure_Exception('Queue name is not specified.');
-		}
-		if (!self::isValidQueueName($queueName)) {
-		    throw new Zend_Service_WindowsAzure_Exception('Queue name does not adhere to queue naming conventions. See http://msdn.microsoft.com/en-us/library/dd179349.aspx for more information.');
-		}
+            $messages = array();
+            for ($i = 0; $i < count($xmlMessages); $i++) {
+                $messages[] = new Zend_Service_WindowsAzure_Storage_QueueMessage(
+                    (string)$xmlMessages[$i]->MessageId,
+                    (string)$xmlMessages[$i]->InsertionTime,
+                    (string)$xmlMessages[$i]->ExpirationTime,
+                    ($peek ? '' : (string)$xmlMessages[$i]->PopReceipt),
+                    ($peek ? '' : (string)$xmlMessages[$i]->TimeNextVisible),
+                    (string)$xmlMessages[$i]->DequeueCount,
+                    base64_decode((string)$xmlMessages[$i]->MessageText)
+                );
+            }
+            
+            return $messages;
+        } else {
+            throw new Zend_Service_WindowsAzure_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
+        }
+    }
+    
+    /**
+     * Peek queue messages
+     *
+     * @param string $queueName         Queue name
+     * @param string $numOfMessages     Optional. A nonzero integer value that specifies the number of messages to retrieve from the queue, up to a maximum of 32. By default, a single message is retrieved from the queue with this operation.
+     * @return array
+     * @throws Zend_Service_WindowsAzure_Exception
+     */
+    public function peekMessages($queueName = '', $numOfMessages = 1)
+    {
+        return $this->getMessages($queueName, $numOfMessages, null, true);
+    }
+    
+    /**
+     * Clear queue messages
+     *
+     * @param string $queueName         Queue name
+     * @throws Zend_Service_WindowsAzure_Exception
+     */
+    public function clearMessages($queueName = '')
+    {
+        if ($queueName === '') {
+            throw new Zend_Service_WindowsAzure_Exception('Queue name is not specified.');
+        }
+        if (!self::isValidQueueName($queueName)) {
+            throw new Zend_Service_WindowsAzure_Exception('Queue name does not adhere to queue naming conventions. See http://msdn.microsoft.com/en-us/library/dd179349.aspx for more information.');
+        }
 
-		// Perform request
-		$response = $this->_performRequest($queueName . '/messages', '', Zend_Http_Client::DELETE);	
-		if (!$response->isSuccessful()) {
-			throw new Zend_Service_WindowsAzure_Exception('Error clearing messages from queue.');
-		}
-	}
-	
-	/**
-	 * Delete queue message
-	 *
-	 * @param string $queueName         					Queue name
-	 * @param Zend_Service_WindowsAzure_Storage_QueueMessage $message Message to delete from queue. A message retrieved using "peekMessages" can NOT be deleted!
-	 * @throws Zend_Service_WindowsAzure_Exception
-	 */
-	public function deleteMessage($queueName = '', Zend_Service_WindowsAzure_Storage_QueueMessage $message)
-	{
-		if ($queueName === '') {
-			throw new Zend_Service_WindowsAzure_Exception('Queue name is not specified.');
-		}
-		if (!self::isValidQueueName($queueName)) {
-		    throw new Zend_Service_WindowsAzure_Exception('Queue name does not adhere to queue naming conventions. See http://msdn.microsoft.com/en-us/library/dd179349.aspx for more information.');
-		}
-		if ($message->PopReceipt == '') {
-		    throw new Zend_Service_WindowsAzure_Exception('A message retrieved using "peekMessages" can NOT be deleted! Use "getMessages" instead.');
-		}
+        // Perform request
+        $response = $this->_performRequest($queueName . '/messages', '', Zend_Http_Client::DELETE);    
+        if (!$response->isSuccessful()) {
+            throw new Zend_Service_WindowsAzure_Exception('Error clearing messages from queue.');
+        }
+    }
+    
+    /**
+     * Delete queue message
+     *
+     * @param string $queueName                             Queue name
+     * @param Zend_Service_WindowsAzure_Storage_QueueMessage $message Message to delete from queue. A message retrieved using "peekMessages" can NOT be deleted!
+     * @throws Zend_Service_WindowsAzure_Exception
+     */
+    public function deleteMessage($queueName = '', Zend_Service_WindowsAzure_Storage_QueueMessage $message)
+    {
+        if ($queueName === '') {
+            throw new Zend_Service_WindowsAzure_Exception('Queue name is not specified.');
+        }
+        if (!self::isValidQueueName($queueName)) {
+            throw new Zend_Service_WindowsAzure_Exception('Queue name does not adhere to queue naming conventions. See http://msdn.microsoft.com/en-us/library/dd179349.aspx for more information.');
+        }
+        if ($message->PopReceipt == '') {
+            throw new Zend_Service_WindowsAzure_Exception('A message retrieved using "peekMessages" can NOT be deleted! Use "getMessages" instead.');
+        }
 
-		// Perform request
-		$response = $this->_performRequest($queueName . '/messages/' . $message->MessageId, '?popreceipt=' . $message->PopReceipt, Zend_Http_Client::DELETE);	
-		if (!$response->isSuccessful()) {
-			throw new Zend_Service_WindowsAzure_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
-		}
-	}
-	
-	/**
-	 * Is valid queue name?
-	 *
-	 * @param string $queueName Queue name
-	 * @return boolean
-	 */
+        // Perform request
+        $response = $this->_performRequest($queueName . '/messages/' . $message->MessageId, '?popreceipt=' . $message->PopReceipt, Zend_Http_Client::DELETE);    
+        if (!$response->isSuccessful()) {
+            throw new Zend_Service_WindowsAzure_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
+        }
+    }
+    
+    /**
+     * Is valid queue name?
+     *
+     * @param string $queueName Queue name
+     * @return boolean
+     */
     public static function isValidQueueName($queueName = '')
     {
         if (preg_match("/^[a-z0-9][a-z0-9-]*$/", $queueName) === 0) {
@@ -536,20 +536,20 @@ class Zend_Service_WindowsAzure_Storage_Queue extends Zend_Service_WindowsAzure_
         return true;
     }
 
-	/**
-	 * Get error message from Zend_Http_Response
-	 *
-	 * @param Zend_Http_Response $response Repsonse
-	 * @param string $alternativeError Alternative error message
-	 * @return string
-	 */
-	protected function _getErrorMessage(Zend_Http_Response $response, $alternativeError = 'Unknown error.')
-	{
-		$response = $this->_parseResponse($response);
-		if ($response && $response->Message) {
-		    return (string)$response->Message;
-		} else {
-		    return $alternativeError;
-		}
-	}
+    /**
+     * Get error message from Zend_Http_Response
+     *
+     * @param Zend_Http_Response $response Repsonse
+     * @param string $alternativeError Alternative error message
+     * @return string
+     */
+    protected function _getErrorMessage(Zend_Http_Response $response, $alternativeError = 'Unknown error.')
+    {
+        $response = $this->_parseResponse($response);
+        if ($response && $response->Message) {
+            return (string)$response->Message;
+        } else {
+            return $alternativeError;
+        }
+    }
 }

+ 1 - 1
library/Zend/Service/WindowsAzure/Storage/QueueInstance.php

@@ -42,7 +42,7 @@ require_once 'Zend/Service/WindowsAzure/Storage/StorageEntityAbstract.php';
  * @property integer $ApproximateMessageCount  The approximate number of messages in the queue
  */
 class Zend_Service_WindowsAzure_Storage_QueueInstance
-	extends Zend_Service_WindowsAzure_Storage_StorageEntityAbstract
+    extends Zend_Service_WindowsAzure_Storage_StorageEntityAbstract
 {
     /**
      * Constructor

+ 4 - 4
library/Zend/Service/WindowsAzure/Storage/QueueMessage.php

@@ -40,13 +40,13 @@ require_once 'Zend/Service/WindowsAzure/Storage/StorageEntityAbstract.php';
  * @property string $MessageId         Message ID
  * @property string $InsertionTime     Insertion time
  * @property string $ExpirationTime    Expiration time
- * @property string $PopReceipt  	   Receipt verification for deleting the message from queue.
+ * @property string $PopReceipt         Receipt verification for deleting the message from queue.
  * @property string $TimeNextVisible   Next time the message is visible in the queue
  * @property int    $DequeueCount      Number of times the message has been dequeued. This value is incremented each time the message is subsequently dequeued.
  * @property string $MessageText       Message text
  */
 class Zend_Service_WindowsAzure_Storage_QueueMessage
-	extends Zend_Service_WindowsAzure_Storage_StorageEntityAbstract
+    extends Zend_Service_WindowsAzure_Storage_StorageEntityAbstract
 {
     /**
      * Constructor
@@ -54,7 +54,7 @@ class Zend_Service_WindowsAzure_Storage_QueueMessage
      * @param string $messageId         Message ID
      * @param string $insertionTime     Insertion time
      * @param string $expirationTime    Expiration time
-     * @param string $popReceipt  	    Receipt verification for deleting the message from queue.
+     * @param string $popReceipt          Receipt verification for deleting the message from queue.
      * @param string $timeNextVisible   Next time the message is visible in the queue
      * @param int    $dequeueCount      Number of times the message has been dequeued. This value is incremented each time the message is subsequently dequeued.
      * @param string $messageText       Message text
@@ -67,7 +67,7 @@ class Zend_Service_WindowsAzure_Storage_QueueMessage
             'expirationtime'  => $expirationTime,
             'popreceipt'      => $popReceipt,
             'timenextvisible' => $timeNextVisible,
-        	'dequeuecount'    => $dequeueCount,
+            'dequeuecount'    => $dequeueCount,
             'messagetext'     => $messageText
         );
     }

+ 1 - 1
library/Zend/Service/WindowsAzure/Storage/SignedIdentifier.php

@@ -43,7 +43,7 @@ require_once 'Zend/Service/WindowsAzure/Storage/StorageEntityAbstract.php';
  * @property string $Permissions  Signed permissions - read (r), write (w), delete (d) and list (l)
  */
 class Zend_Service_WindowsAzure_Storage_SignedIdentifier
-	extends Zend_Service_WindowsAzure_Storage_StorageEntityAbstract
+    extends Zend_Service_WindowsAzure_Storage_StorageEntityAbstract
 {
     /**
      * Constructor

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 512 - 512
library/Zend/Service/WindowsAzure/Storage/Table.php


+ 18 - 18
library/Zend/Service/WindowsAzure/Storage/TableEntity.php

@@ -72,7 +72,7 @@ class Zend_Service_WindowsAzure_Storage_TableEntity
      * @param string  $rowKey          Row key
      */
     public function __construct($partitionKey = '', $rowKey = '')
-    {	
+    {    
         $this->_partitionKey = $partitionKey;
         $this->_rowKey       = $rowKey;
     }
@@ -183,15 +183,15 @@ class Zend_Service_WindowsAzure_Storage_TableEntity
                 $property = $accessor->EntityAccessor;
                 $returnValue[] = (object)array(
                     'Name'  => $accessor->AzurePropertyName,
-                	'Type'  => $accessor->AzurePropertyType,
-                	'Value' => $this->$property,
+                    'Type'  => $accessor->AzurePropertyType,
+                    'Value' => $this->$property,
                 );
             } else if ($accessor->EntityType == 'ReflectionMethod' && substr(strtolower($accessor->EntityAccessor), 0, 3) == 'get') {
                 $method = $accessor->EntityAccessor;
                 $returnValue[] = (object)array(
                     'Name'  => $accessor->AzurePropertyName,
-                	'Type'  => $accessor->AzurePropertyType,
-                	'Value' => $this->$method(),
+                    'Type'  => $accessor->AzurePropertyType,
+                    'Value' => $this->$method(),
                 );
             }
         }
@@ -219,18 +219,18 @@ class Zend_Service_WindowsAzure_Storage_TableEntity
                 // Cast to correct type
                 if ($accessor->AzurePropertyType != '') {
                     switch (strtolower($accessor->AzurePropertyType)) {
-        	            case 'edm.int32':
-        	            case 'edm.int64':
-        	                $values[$accessor->AzurePropertyName] = intval($values[$accessor->AzurePropertyName]); break;
-        	            case 'edm.boolean':
-        	                if ($values[$accessor->AzurePropertyName] == 'true' || $values[$accessor->AzurePropertyName] == '1')
-        	                    $values[$accessor->AzurePropertyName] = true;
-        	                else
-        	                    $values[$accessor->AzurePropertyName] = false;
-        	                break;
-        	            case 'edm.double':
-        	                $values[$accessor->AzurePropertyName] = floatval($values[$accessor->AzurePropertyName]); break;
-        	        }
+                        case 'edm.int32':
+                        case 'edm.int64':
+                            $values[$accessor->AzurePropertyName] = intval($values[$accessor->AzurePropertyName]); break;
+                        case 'edm.boolean':
+                            if ($values[$accessor->AzurePropertyName] == 'true' || $values[$accessor->AzurePropertyName] == '1')
+                                $values[$accessor->AzurePropertyName] = true;
+                            else
+                                $values[$accessor->AzurePropertyName] = false;
+                            break;
+                        case 'edm.double':
+                            $values[$accessor->AzurePropertyName] = floatval($values[$accessor->AzurePropertyName]); break;
+                    }
                 }
 
                 // Assign value
@@ -322,7 +322,7 @@ class Zend_Service_WindowsAzure_Storage_TableEntity
             'EntityAccessor'    => $member->getName(),
             'EntityType'        => get_class($member),
             'AzurePropertyName' => $azureProperties[0],
-        	'AzurePropertyType' => isset($azureProperties[1]) ? $azureProperties[1] : ''
+            'AzurePropertyType' => isset($azureProperties[1]) ? $azureProperties[1] : ''
         );
     }
 }

+ 299 - 299
library/Zend/Service/WindowsAzure/Storage/TableEntityQuery.php

@@ -34,317 +34,317 @@ class Zend_Service_WindowsAzure_Storage_TableEntityQuery
      *
      * @var string
      */
-	protected $_from  = '';
-	
-	/**
-	 * Where
-	 *
-	 * @var array
-	 */
-	protected $_where = array();
-	
-	/**
-	 * Order by
-	 *
-	 * @var array
-	 */
-	protected $_orderBy = array();
-	
-	/**
-	 * Top
-	 *
-	 * @var int
-	 */
-	protected $_top = null;
-	
-	/**
-	 * Partition key
-	 *
-	 * @var string
-	 */
-	protected $_partitionKey = null;
+    protected $_from  = '';
+    
+    /**
+     * Where
+     *
+     * @var array
+     */
+    protected $_where = array();
+    
+    /**
+     * Order by
+     *
+     * @var array
+     */
+    protected $_orderBy = array();
+    
+    /**
+     * Top
+     *
+     * @var int
+     */
+    protected $_top = null;
+    
+    /**
+     * Partition key
+     *
+     * @var string
+     */
+    protected $_partitionKey = null;
 
-	/**
-	 * Row key
-	 *
-	 * @var string
-	 */
-	protected $_rowKey = null;
-	
-	/**
-	 * Select clause
-	 *
-	 * @return Zend_Service_WindowsAzure_Storage_TableEntityQuery
-	 */
-	public function select()
-	{
-		return $this;
-	}
-	
-	/**
-	 * From clause
-	 *
-	 * @param string $name Table name to select entities from
-	 * @return Zend_Service_WindowsAzure_Storage_TableEntityQuery
-	 */
-	public function from($name)
-	{
-		$this->_from = $name;
-		return $this;
-	}
-	
-	/**
-	 * Specify partition key
-	 *
-	 * @param string $value Partition key to query for
-	 * @return Zend_Service_WindowsAzure_Storage_TableEntityQuery
-	 */
-	public function wherePartitionKey($value = null)
-	{
-	    $this->_partitionKey = $value;
-	    return $this;
-	}
-	
-	/**
-	 * Specify row key
-	 *
-	 * @param string $value Row key to query for
-	 * @return Zend_Service_WindowsAzure_Storage_TableEntityQuery
-	 */
-	public function whereRowKey($value = null)
-	{
-	    $this->_rowKey = $value;
-	    return $this;
-	}
-	
-	/**
-	 * Add where clause
-	 *
-	 * @param string       $condition   Condition, can contain question mark(s) (?) for parameter insertion.
-	 * @param string|array $value       Value(s) to insert in question mark (?) parameters.
-	 * @param string       $cond        Condition for the clause (and/or/not)
-	 * @return Zend_Service_WindowsAzure_Storage_TableEntityQuery
-	 */
-	public function where($condition, $value = null, $cond = '')
-	{
-	    $condition = $this->_replaceOperators($condition);
-	
-	    if ($value !== null) {
-	        $condition = $this->_quoteInto($condition, $value);
-	    }
-	
-		if (count($this->_where) == 0) {
-			$cond = '';
-		} else if ($cond !== '') {
-			$cond = ' ' . strtolower(trim($cond)) . ' ';
-		}
-		
-		$this->_where[] = $cond . $condition;
-		return $this;
-	}
+    /**
+     * Row key
+     *
+     * @var string
+     */
+    protected $_rowKey = null;
+    
+    /**
+     * Select clause
+     *
+     * @return Zend_Service_WindowsAzure_Storage_TableEntityQuery
+     */
+    public function select()
+    {
+        return $this;
+    }
+    
+    /**
+     * From clause
+     *
+     * @param string $name Table name to select entities from
+     * @return Zend_Service_WindowsAzure_Storage_TableEntityQuery
+     */
+    public function from($name)
+    {
+        $this->_from = $name;
+        return $this;
+    }
+    
+    /**
+     * Specify partition key
+     *
+     * @param string $value Partition key to query for
+     * @return Zend_Service_WindowsAzure_Storage_TableEntityQuery
+     */
+    public function wherePartitionKey($value = null)
+    {
+        $this->_partitionKey = $value;
+        return $this;
+    }
+    
+    /**
+     * Specify row key
+     *
+     * @param string $value Row key to query for
+     * @return Zend_Service_WindowsAzure_Storage_TableEntityQuery
+     */
+    public function whereRowKey($value = null)
+    {
+        $this->_rowKey = $value;
+        return $this;
+    }
+    
+    /**
+     * Add where clause
+     *
+     * @param string       $condition   Condition, can contain question mark(s) (?) for parameter insertion.
+     * @param string|array $value       Value(s) to insert in question mark (?) parameters.
+     * @param string       $cond        Condition for the clause (and/or/not)
+     * @return Zend_Service_WindowsAzure_Storage_TableEntityQuery
+     */
+    public function where($condition, $value = null, $cond = '')
+    {
+        $condition = $this->_replaceOperators($condition);
+    
+        if ($value !== null) {
+            $condition = $this->_quoteInto($condition, $value);
+        }
+    
+        if (count($this->_where) == 0) {
+            $cond = '';
+        } else if ($cond !== '') {
+            $cond = ' ' . strtolower(trim($cond)) . ' ';
+        }
+        
+        $this->_where[] = $cond . $condition;
+        return $this;
+    }
 
-	/**
-	 * Add where clause with AND condition
-	 *
-	 * @param string       $condition   Condition, can contain question mark(s) (?) for parameter insertion.
-	 * @param string|array $value       Value(s) to insert in question mark (?) parameters.
-	 * @return Zend_Service_WindowsAzure_Storage_TableEntityQuery
-	 */
-	public function andWhere($condition, $value = null)
-	{
-		return $this->where($condition, $value, 'and');
-	}
-	
-	/**
-	 * Add where clause with OR condition
-	 *
-	 * @param string       $condition   Condition, can contain question mark(s) (?) for parameter insertion.
-	 * @param string|array $value       Value(s) to insert in question mark (?) parameters.
-	 * @return Zend_Service_WindowsAzure_Storage_TableEntityQuery
-	 */
-	public function orWhere($condition, $value = null)
-	{
-		return $this->where($condition, $value, 'or');
-	}
-	
-	/**
-	 * OrderBy clause
-	 *
-	 * @param string $column    Column to sort by
-	 * @param string $direction Direction to sort (asc/desc)
-	 * @return Zend_Service_WindowsAzure_Storage_TableEntityQuery
-	 */
-	public function orderBy($column, $direction = 'asc')
-	{
-		$this->_orderBy[] = $column . ' ' . $direction;
-		return $this;
-	}
+    /**
+     * Add where clause with AND condition
+     *
+     * @param string       $condition   Condition, can contain question mark(s) (?) for parameter insertion.
+     * @param string|array $value       Value(s) to insert in question mark (?) parameters.
+     * @return Zend_Service_WindowsAzure_Storage_TableEntityQuery
+     */
+    public function andWhere($condition, $value = null)
+    {
+        return $this->where($condition, $value, 'and');
+    }
+    
+    /**
+     * Add where clause with OR condition
+     *
+     * @param string       $condition   Condition, can contain question mark(s) (?) for parameter insertion.
+     * @param string|array $value       Value(s) to insert in question mark (?) parameters.
+     * @return Zend_Service_WindowsAzure_Storage_TableEntityQuery
+     */
+    public function orWhere($condition, $value = null)
+    {
+        return $this->where($condition, $value, 'or');
+    }
+    
+    /**
+     * OrderBy clause
+     *
+     * @param string $column    Column to sort by
+     * @param string $direction Direction to sort (asc/desc)
+     * @return Zend_Service_WindowsAzure_Storage_TableEntityQuery
+     */
+    public function orderBy($column, $direction = 'asc')
+    {
+        $this->_orderBy[] = $column . ' ' . $direction;
+        return $this;
+    }
 
-	/**
-	 * Top clause
-	 *
-	 * @param int $top  Top to fetch
-	 * @return Zend_Service_WindowsAzure_Storage_TableEntityQuery
-	 */
+    /**
+     * Top clause
+     *
+     * @param int $top  Top to fetch
+     * @return Zend_Service_WindowsAzure_Storage_TableEntityQuery
+     */
     public function top($top = null)
     {
         $this->_top  = (int)$top;
         return $this;
     }
-	
+    
     /**
      * Assembles the query string
      *
      * @param boolean $urlEncode Apply URL encoding to the query string
      * @return string
      */
-	public function assembleQueryString($urlEncode = false)
-	{
-		$query = array();
-		if (count($this->_where) != 0) {
-		    $filter = implode('', $this->_where);
-			$query[] = '$filter=' . ($urlEncode ? self::encodeQuery($filter) : $filter);
-		}
-		
-		if (count($this->_orderBy) != 0) {
-		    $orderBy = implode(',', $this->_orderBy);
-			$query[] = '$orderby=' . ($urlEncode ? self::encodeQuery($orderBy) : $orderBy);
-		}
-		
-		if ($this->_top !== null) {
-			$query[] = '$top=' . $this->_top;
-		}
-		
-		if (count($query) != 0) {
-			return '?' . implode('&', $query);
-		}
-		
-		return '';
-	}
-	
-	/**
-	 * Assemble from
-	 *
-	 * @param boolean $includeParentheses Include parentheses? ()
-	 * @return string
-	 */
-	public function assembleFrom($includeParentheses = true)
-	{
-	    $identifier = '';
-	    if ($includeParentheses) {
-	        $identifier .= '(';
-	
-	        if ($this->_partitionKey !== null) {
-	            $identifier .= 'PartitionKey=\'' . $this->_partitionKey . '\'';
-	        }
-	
-	        if ($this->_partitionKey !== null && $this->_rowKey !== null) {
-	            $identifier .= ', ';
-	        }
-	
-	        if ($this->_rowKey !== null) {
-	            $identifier .= 'RowKey=\'' . $this->_rowKey . '\'';
-	        }
-	
-	        $identifier .= ')';
-	    }
-		return $this->_from . $identifier;
-	}
-	
-	/**
-	 * Assemble full query
-	 *
-	 * @return string
-	 */
-	public function assembleQuery()
-	{
-		$assembledQuery = $this->assembleFrom();
-		
-		$queryString = $this->assembleQueryString();
-		if ($queryString !== '') {
-			$assembledQuery .= $queryString;
-		}
-		
-		return $assembledQuery;
-	}
-	
-	/**
-	 * Quotes a variable into a condition
-	 *
-	 * @param string       $text   Condition, can contain question mark(s) (?) for parameter insertion.
-	 * @param string|array $value  Value(s) to insert in question mark (?) parameters.
-	 * @return string
-	 */
-	protected function _quoteInto($text, $value = null)
-	{
-		if (!is_array($value)) {
-	        $text = str_replace('?', '\'' . addslashes($value) . '\'', $text);
-	    } else {
-	        $i = 0;
-	        while(strpos($text, '?') !== false) {
-	            if (is_numeric($value[$i])) {
-	                $text = substr_replace($text, $value[$i++], strpos($text, '?'), 1);
-	            } else {
-	                $text = substr_replace($text, '\'' . addslashes($value[$i++]) . '\'', strpos($text, '?'), 1);
-	            }
-	        }
-	    }
-	    return $text;
-	}
-	
-	/**
-	 * Replace operators
-	 *
-	 * @param string $text
-	 * @return string
-	 */
-	protected function _replaceOperators($text)
-	{
-	    $text = str_replace('==', 'eq',  $text);
-	    $text = str_replace('>',  'gt',  $text);
-	    $text = str_replace('<',  'lt',  $text);
-	    $text = str_replace('>=', 'ge',  $text);
-	    $text = str_replace('<=', 'le',  $text);
-	    $text = str_replace('!=', 'ne',  $text);
-	
-	    $text = str_replace('&&', 'and', $text);
-	    $text = str_replace('||', 'or',  $text);
-	    $text = str_replace('!',  'not', $text);
-	
-	    return $text;
-	}
-	
-	/**
-	 * urlencode a query
-	 *
-	 * @param string $query Query to encode
-	 * @return string Encoded query
-	 */
-	public static function encodeQuery($query)
-	{
-		$query = str_replace('/', '%2F', $query);
-		$query = str_replace('?', '%3F', $query);
-		$query = str_replace(':', '%3A', $query);
-		$query = str_replace('@', '%40', $query);
-		$query = str_replace('&', '%26', $query);
-		$query = str_replace('=', '%3D', $query);
-		$query = str_replace('+', '%2B', $query);
-		$query = str_replace(',', '%2C', $query);
-		$query = str_replace('$', '%24', $query);
-		
-		
-		$query = str_replace(' ', '%20', $query);
-		
-		return $query;
-	}
-	
-	/**
-	 * __toString overload
-	 *
-	 * @return string
-	 */
-	public function __toString()
-	{
-		return $this->assembleQuery();
-	}
+    public function assembleQueryString($urlEncode = false)
+    {
+        $query = array();
+        if (count($this->_where) != 0) {
+            $filter = implode('', $this->_where);
+            $query[] = '$filter=' . ($urlEncode ? self::encodeQuery($filter) : $filter);
+        }
+        
+        if (count($this->_orderBy) != 0) {
+            $orderBy = implode(',', $this->_orderBy);
+            $query[] = '$orderby=' . ($urlEncode ? self::encodeQuery($orderBy) : $orderBy);
+        }
+        
+        if ($this->_top !== null) {
+            $query[] = '$top=' . $this->_top;
+        }
+        
+        if (count($query) != 0) {
+            return '?' . implode('&', $query);
+        }
+        
+        return '';
+    }
+    
+    /**
+     * Assemble from
+     *
+     * @param boolean $includeParentheses Include parentheses? ()
+     * @return string
+     */
+    public function assembleFrom($includeParentheses = true)
+    {
+        $identifier = '';
+        if ($includeParentheses) {
+            $identifier .= '(';
+    
+            if ($this->_partitionKey !== null) {
+                $identifier .= 'PartitionKey=\'' . $this->_partitionKey . '\'';
+            }
+    
+            if ($this->_partitionKey !== null && $this->_rowKey !== null) {
+                $identifier .= ', ';
+            }
+    
+            if ($this->_rowKey !== null) {
+                $identifier .= 'RowKey=\'' . $this->_rowKey . '\'';
+            }
+    
+            $identifier .= ')';
+        }
+        return $this->_from . $identifier;
+    }
+    
+    /**
+     * Assemble full query
+     *
+     * @return string
+     */
+    public function assembleQuery()
+    {
+        $assembledQuery = $this->assembleFrom();
+        
+        $queryString = $this->assembleQueryString();
+        if ($queryString !== '') {
+            $assembledQuery .= $queryString;
+        }
+        
+        return $assembledQuery;
+    }
+    
+    /**
+     * Quotes a variable into a condition
+     *
+     * @param string       $text   Condition, can contain question mark(s) (?) for parameter insertion.
+     * @param string|array $value  Value(s) to insert in question mark (?) parameters.
+     * @return string
+     */
+    protected function _quoteInto($text, $value = null)
+    {
+        if (!is_array($value)) {
+            $text = str_replace('?', '\'' . addslashes($value) . '\'', $text);
+        } else {
+            $i = 0;
+            while(strpos($text, '?') !== false) {
+                if (is_numeric($value[$i])) {
+                    $text = substr_replace($text, $value[$i++], strpos($text, '?'), 1);
+                } else {
+                    $text = substr_replace($text, '\'' . addslashes($value[$i++]) . '\'', strpos($text, '?'), 1);
+                }
+            }
+        }
+        return $text;
+    }
+    
+    /**
+     * Replace operators
+     *
+     * @param string $text
+     * @return string
+     */
+    protected function _replaceOperators($text)
+    {
+        $text = str_replace('==', 'eq',  $text);
+        $text = str_replace('>',  'gt',  $text);
+        $text = str_replace('<',  'lt',  $text);
+        $text = str_replace('>=', 'ge',  $text);
+        $text = str_replace('<=', 'le',  $text);
+        $text = str_replace('!=', 'ne',  $text);
+    
+        $text = str_replace('&&', 'and', $text);
+        $text = str_replace('||', 'or',  $text);
+        $text = str_replace('!',  'not', $text);
+    
+        return $text;
+    }
+    
+    /**
+     * urlencode a query
+     *
+     * @param string $query Query to encode
+     * @return string Encoded query
+     */
+    public static function encodeQuery($query)
+    {
+        $query = str_replace('/', '%2F', $query);
+        $query = str_replace('?', '%3F', $query);
+        $query = str_replace(':', '%3A', $query);
+        $query = str_replace('@', '%40', $query);
+        $query = str_replace('&', '%26', $query);
+        $query = str_replace('=', '%3D', $query);
+        $query = str_replace('+', '%2B', $query);
+        $query = str_replace(',', '%2C', $query);
+        $query = str_replace('$', '%24', $query);
+        
+        
+        $query = str_replace(' ', '%20', $query);
+        
+        return $query;
+    }
+    
+    /**
+     * __toString overload
+     *
+     * @return string
+     */
+    public function __toString()
+    {
+        return $this->assembleQuery();
+    }
 }

+ 2 - 2
library/Zend/Service/WindowsAzure/Storage/TableInstance.php

@@ -43,7 +43,7 @@ require_once 'Zend/Service/WindowsAzure/Storage/StorageEntityAbstract.php';
  * @property string  $Updated         Updated
  */
 class Zend_Service_WindowsAzure_Storage_TableInstance
-	extends Zend_Service_WindowsAzure_Storage_StorageEntityAbstract
+    extends Zend_Service_WindowsAzure_Storage_StorageEntityAbstract
 {
     /**
      * Constructor
@@ -54,7 +54,7 @@ class Zend_Service_WindowsAzure_Storage_TableInstance
      * @param string  $updated         Updated
      */
     public function __construct($id, $name, $href, $updated)
-    {	
+    {    
         $this->_data = array(
             'id'               => $id,
             'name'             => $name,

+ 9 - 9
library/Zend/View/Helper/Doctype.php

@@ -186,15 +186,15 @@ class Zend_View_Helper_Doctype extends Zend_View_Helper_Abstract
     {
         return (stristr($this->getDoctype(), 'xhtml') ? true : false);
     }
-	
-	/**
-	 * Is doctype HTML5? (HeadMeta uses this for validation)
-	 *
-	 * @return booleean
-	 */
-	public function isHtml5() {
-		return (stristr($this->doctype(), '<!DOCTYPE html>') ? true : false);
-	}
+    
+    /**
+     * Is doctype HTML5? (HeadMeta uses this for validation)
+     *
+     * @return booleean
+     */
+    public function isHtml5() {
+        return (stristr($this->doctype(), '<!DOCTYPE html>') ? true : false);
+    }
 
     /**
      * String representation of doctype

+ 11 - 11
library/Zend/View/Helper/HeadMeta.php

@@ -162,14 +162,14 @@ class Zend_View_Helper_HeadMeta extends Zend_View_Helper_Placeholder_Container_S
         return parent::__call($method, $args);
     }
 
-	/**
-	 * Create an HTML5-style meta charset tag. Something like <meta charset="utf-8">
-	 *
-	 * Not valid in a non-HTML5 doctype
-	 *
-	 * @param string $charset
-	 * @return Zend_View_Helper_HeadMeta Provides a fluent interface
-	 */
+    /**
+     * Create an HTML5-style meta charset tag. Something like <meta charset="utf-8">
+     *
+     * Not valid in a non-HTML5 doctype
+     *
+     * @param string $charset
+     * @return Zend_View_Helper_HeadMeta Provides a fluent interface
+     */
     public function setCharset($charset)
     {
         $item = new stdClass;
@@ -344,9 +344,9 @@ class Zend_View_Helper_HeadMeta extends Zend_View_Helper_Placeholder_Container_S
         if ($this->view instanceof Zend_View_Abstract) {
             if ($this->view->doctype()->isHtml5()
             && $type == 'charset') {
-				$tpl = ($this->view->doctype()->isXhtml())
-					? '<meta %s="%s"/>'
-					: '<meta %s="%s">';
+                $tpl = ($this->view->doctype()->isXhtml())
+                    ? '<meta %s="%s"/>'
+                    : '<meta %s="%s">';
             } elseif ($this->view->doctype()->isXhtml()) {
                 $tpl = '<meta %s="%s" content="%s" %s/>';
             } else {

Một số tệp đã không được hiển thị bởi vì quá nhiều tập tin thay đổi trong này khác