BlobInstance.php 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  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$
  21. */
  22. /**
  23. * @see Zend_Service_WindowsAzure_Exception
  24. */
  25. require_once 'Zend/Service/WindowsAzure/Exception.php';
  26. /**
  27. * @see Zend_Service_WindowsAzure_Storage_StorageEntityAbstract
  28. */
  29. require_once 'Zend/Service/WindowsAzure/Storage/StorageEntityAbstract.php';
  30. /**
  31. * @category Zend
  32. * @package Zend_Service_WindowsAzure
  33. * @subpackage Storage
  34. * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  35. * @license http://framework.zend.com/license/new-bsd New BSD License
  36. *
  37. * @property string $Container Container name
  38. * @property string $Name Name
  39. * @property string $SnapshotId Snapshot id
  40. * @property string $Etag Etag
  41. * @property string $LastModified Last modified date
  42. * @property string $Url Url
  43. * @property int $Size Size
  44. * @property string $ContentType Content Type
  45. * @property string $ContentEncoding Content Encoding
  46. * @property string $ContentLanguage Content Language
  47. * @property string $CacheControl Cache control
  48. * @property string $BlobType Blob type
  49. * @property string $LeaseStatus Lease status
  50. * @property boolean $IsPrefix Is Prefix?
  51. * @property array $Metadata Key/value pairs of meta data
  52. */
  53. class Zend_Service_WindowsAzure_Storage_BlobInstance
  54. {
  55. /**
  56. * Data
  57. *
  58. * @var array
  59. */
  60. protected $_data = null;
  61. /**
  62. * Constructor
  63. *
  64. * @param string $containerName Container name
  65. * @param string $name Name
  66. * @param string $snapshotId Snapshot id
  67. * @param string $etag Etag
  68. * @param string $lastModified Last modified date
  69. * @param string $url Url
  70. * @param int $size Size
  71. * @param string $contentType Content Type
  72. * @param string $contentEncoding Content Encoding
  73. * @param string $contentLanguage Content Language
  74. * @param string $cacheControl Cache control
  75. * @param string $blobType Blob type
  76. * @param string $leaseStatus Lease status
  77. * @param boolean $isPrefix Is Prefix?
  78. * @param array $metadata Key/value pairs of meta data
  79. */
  80. public function __construct($containerName, $name, $snapshotId, $etag, $lastModified, $url = '', $size = 0, $contentType = '', $contentEncoding = '', $contentLanguage = '', $cacheControl = '', $blobType = '', $leaseStatus = '', $isPrefix = false, $metadata = array())
  81. {
  82. $this->_data = array(
  83. 'container' => $containerName,
  84. 'name' => $name,
  85. 'snapshotid' => $snapshotId,
  86. 'etag' => $etag,
  87. 'lastmodified' => $lastModified,
  88. 'url' => $url,
  89. 'size' => $size,
  90. 'contenttype' => $contentType,
  91. 'contentencoding' => $contentEncoding,
  92. 'contentlanguage' => $contentLanguage,
  93. 'cachecontrol' => $cacheControl,
  94. 'blobtype' => $blobType,
  95. 'leasestatus' => $leaseStatus,
  96. 'isprefix' => $isPrefix,
  97. 'metadata' => $metadata
  98. );
  99. }
  100. /**
  101. * Magic overload for setting properties
  102. *
  103. * @param string $name Name of the property
  104. * @param string $value Value to set
  105. */
  106. public function __set($name, $value) {
  107. if (array_key_exists(strtolower($name), $this->_data)) {
  108. $this->_data[strtolower($name)] = $value;
  109. return;
  110. }
  111. throw new Exception("Unknown property: " . $name);
  112. }
  113. /**
  114. * Magic overload for getting properties
  115. *
  116. * @param string $name Name of the property
  117. */
  118. public function __get($name) {
  119. if (array_key_exists(strtolower($name), $this->_data)) {
  120. return $this->_data[strtolower($name)];
  121. }
  122. throw new Exception("Unknown property: " . $name);
  123. }
  124. }