InitiateWormConfig.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. namespace OSS\Model;
  3. use OSS\Core\OssException;
  4. /**
  5. * Class InitiateWormConfig
  6. * @package OSS\Model
  7. *
  8. */
  9. class InitiateWormConfig implements XmlConfig
  10. {
  11. /**
  12. * InitiateWormConfig constructor.
  13. * @param null $day
  14. */
  15. public function __construct($day = null)
  16. {
  17. $this->day = $day;
  18. }
  19. /**
  20. * Parse InitiateWormConfig from the xml.
  21. *
  22. * @param string $strXml
  23. * @throws OssException
  24. * @return null
  25. */
  26. public function parseFromXml($strXml)
  27. {
  28. throw new OssException("Not implemented.");
  29. }
  30. /**
  31. * Serialize the object into xml string.
  32. *
  33. * @return string
  34. */
  35. public function serializeToXml()
  36. {
  37. $xml = new \SimpleXMLElement('<?xml version="1.0" encoding="utf-8"?><InitiateWormConfiguration></InitiateWormConfiguration>');
  38. if (isset($this->day)) {
  39. $xml->addChild('RetentionPeriodInDays', $this->day);
  40. }
  41. return $xml->asXML();
  42. }
  43. public function __toString()
  44. {
  45. return $this->serializeToXml();
  46. }
  47. /**
  48. * @return int
  49. */
  50. public function getDay()
  51. {
  52. return $this->day;
  53. }
  54. private $day = 0;
  55. }