StorageCapacityConfig.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <?php
  2. namespace OSS\Model;
  3. /**
  4. * Class StorageCapacityConfig
  5. *
  6. * @package OSS\Model
  7. * @link http://docs.alibaba-inc.com/pages/viewpage.action?pageId=271614763
  8. */
  9. class StorageCapacityConfig implements XmlConfig
  10. {
  11. /**
  12. * StorageCapacityConfig constructor.
  13. *
  14. * @param int $storageCapacity
  15. */
  16. public function __construct($storageCapacity)
  17. {
  18. $this->storageCapacity = $storageCapacity;
  19. }
  20. /**
  21. * Not implemented
  22. */
  23. public function parseFromXml($strXml)
  24. {
  25. throw new OssException("Not implemented.");
  26. }
  27. /**
  28. * 把StorageCapacityConfig序列化成xml
  29. *
  30. * @return string
  31. */
  32. public function serializeToXml()
  33. {
  34. $xml = new \SimpleXMLElement('<?xml version="1.0" encoding="utf-8"?><BucketUserQos></BucketUserQos>');
  35. $xml->addChild('StorageCapacity', strval($this->storageCapacity));
  36. return $xml->asXML();
  37. }
  38. /**
  39. * To string
  40. *
  41. * @return string
  42. */
  43. function __toString()
  44. {
  45. return $this->serializeToXml();
  46. }
  47. /**
  48. * Set storage capacity
  49. *
  50. * @param int $storageCapacity
  51. */
  52. public function setStorageCapacity($storageCapacity)
  53. {
  54. $this->storageCapacity = $storageCapacity;
  55. }
  56. /**
  57. * Get storage capacity
  58. *
  59. * @return int
  60. */
  61. public function getStorageCapacity()
  62. {
  63. return $this->storageCapacity;
  64. }
  65. private $storageCapacity = 0;
  66. }