StorageCapacityConfig.php 1.5 KB

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