WormConfig.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. <?php
  2. namespace OSS\Model;
  3. use OSS\Core\OssException;
  4. /**
  5. * Class WormConfig
  6. * @package OSS\Model
  7. *
  8. */
  9. class WormConfig implements XmlConfig
  10. {
  11. /**
  12. * Parse WormConfig from the xml.
  13. *
  14. * @param string $strXml
  15. * @throws OssException
  16. * @return null
  17. */
  18. public function parseFromXml($strXml)
  19. {
  20. $xml = simplexml_load_string($strXml);
  21. if (isset($xml->WormId)) {
  22. $this->wormId = strval($xml->WormId);
  23. }
  24. if (isset($xml->State)) {
  25. $this->state = strval($xml->State);
  26. }
  27. if (isset($xml->RetentionPeriodInDays)) {
  28. $this->day = intval($xml->RetentionPeriodInDays);
  29. }
  30. if (isset($xml->CreationDate)) {
  31. $this->creationDate = strval($xml->CreationDate);
  32. }
  33. }
  34. /**
  35. * Serialize the object into xml string.
  36. *
  37. * @return string
  38. */
  39. public function serializeToXml()
  40. {
  41. throw new OssException("Not implemented.");
  42. }
  43. public function __toString()
  44. {
  45. return $this->serializeToXml();
  46. }
  47. /**
  48. * @return string
  49. */
  50. public function getWormId()
  51. {
  52. return $this->wormId;
  53. }
  54. /**
  55. * @return string
  56. */
  57. public function getState()
  58. {
  59. return $this->state;
  60. }
  61. /**
  62. * @return int
  63. */
  64. public function getDay()
  65. {
  66. return $this->day;
  67. }
  68. /**
  69. * @return string
  70. */
  71. public function getCreationDate()
  72. {
  73. return $this->creationDate;
  74. }
  75. private $wormId = '';
  76. private $state = '';
  77. private $creationDate = '';
  78. private $day = 0;
  79. }