QueueInstance.php 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <?php
  2. /**
  3. * Zend Framework
  4. *
  5. * LICENSE
  6. *
  7. * This source file is subject to the new BSD license that is bundled
  8. * with this package in the file LICENSE.txt.
  9. * It is also available through the world-wide-web at this URL:
  10. * http://framework.zend.com/license/new-bsd
  11. * If you did not receive a copy of the license and are unable to
  12. * obtain it through the world-wide-web, please send an email
  13. * to license@zend.com so we can send you a copy immediately.
  14. *
  15. * @category Zend
  16. * @package Zend_Service_WindowsAzure
  17. * @subpackage Storage
  18. * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  19. * @license http://framework.zend.com/license/new-bsd New BSD License
  20. * @version $Id: BlobContainer.php 17553 2009-05-15 10:40:55Z unknown $
  21. */
  22. /**
  23. * @see Zend_Service_WindowsAzure_Exception
  24. */
  25. require_once 'Zend/Service/WindowsAzure/Exception.php';
  26. /**
  27. * @category Zend
  28. * @package Zend_Service_WindowsAzure
  29. * @subpackage Storage
  30. * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  31. * @license http://framework.zend.com/license/new-bsd New BSD License
  32. *
  33. * @property string $Name Name of the queue
  34. * @property array $Metadata Key/value pairs of meta data
  35. * @property integer $ApproximateMessageCount The approximate number of messages in the queue
  36. */
  37. class Zend_Service_WindowsAzure_Storage_QueueInstance
  38. {
  39. /**
  40. * Data
  41. *
  42. * @var array
  43. */
  44. protected $_data = null;
  45. /**
  46. * Constructor
  47. *
  48. * @param string $name Name
  49. * @param array $metadata Key/value pairs of meta data
  50. */
  51. public function __construct($name, $metadata = array())
  52. {
  53. $this->_data = array(
  54. 'name' => $name,
  55. 'metadata' => $metadata,
  56. 'approximatemessagecount' => 0
  57. );
  58. }
  59. /**
  60. * Magic overload for setting properties
  61. *
  62. * @param string $name Name of the property
  63. * @param string $value Value to set
  64. */
  65. public function __set($name, $value) {
  66. if (array_key_exists(strtolower($name), $this->_data)) {
  67. $this->_data[strtolower($name)] = $value;
  68. return;
  69. }
  70. throw new Exception("Unknown property: " . $name);
  71. }
  72. /**
  73. * Magic overload for getting properties
  74. *
  75. * @param string $name Name of the property
  76. */
  77. public function __get($name) {
  78. if (array_key_exists(strtolower($name), $this->_data)) {
  79. return $this->_data[strtolower($name)];
  80. }
  81. throw new Exception("Unknown property: " . $name);
  82. }
  83. }