BucketStat.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <?php
  2. namespace OSS\Model;
  3. /**
  4. * Bucket stat class.
  5. *
  6. * Class BucketStat
  7. * @package OSS\Model
  8. */
  9. class BucketStat
  10. {
  11. /**
  12. * Get storage
  13. *
  14. * @return int
  15. */
  16. public function getStorage()
  17. {
  18. return $this->storage;
  19. }
  20. /**
  21. * Get object count
  22. *
  23. * @return int
  24. */
  25. public function getObjectCount()
  26. {
  27. return $this->objectCount;
  28. }
  29. /**
  30. * Get multipart upload count.
  31. *
  32. * @return int
  33. */
  34. public function getMultipartUploadCount()
  35. {
  36. return $this->multipartUploadCount;
  37. }
  38. /**
  39. * Parse stat from the xml.
  40. *
  41. * @param string $strXml
  42. * @throws OssException
  43. * @return null
  44. */
  45. public function parseFromXml($strXml)
  46. {
  47. $xml = simplexml_load_string($strXml);
  48. if (isset($xml->Storage) ) {
  49. $this->storage = intval($xml->Storage);
  50. }
  51. if (isset($xml->ObjectCount) ) {
  52. $this->objectCount = intval($xml->ObjectCount);
  53. }
  54. if (isset($xml->MultipartUploadCount) ) {
  55. $this->multipartUploadCount = intval($xml->MultipartUploadCount);
  56. }
  57. }
  58. /**
  59. * current storage
  60. *
  61. * @var int
  62. */
  63. private $storage;
  64. /**
  65. * object count
  66. *
  67. * @var int
  68. */
  69. private $objectCount;
  70. /**
  71. * multipart upload count
  72. *
  73. * @var int
  74. */
  75. private $multipartUploadCount;
  76. }