LifecycleAction.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <?php
  2. namespace OSS\Model;
  3. /**
  4. * Class LifecycleAction
  5. * @package OSS\Model
  6. * @link http://help.aliyun.com/document_detail/oss/api-reference/bucket/PutBucketLifecycle.html
  7. */
  8. class LifecycleAction
  9. {
  10. /**
  11. * LifecycleAction constructor.
  12. * @param string $action
  13. * @param string $timeSpec
  14. * @param string $timeValue
  15. */
  16. public function __construct($action, $timeSpec, $timeValue)
  17. {
  18. $this->action = $action;
  19. $this->timeSpec = $timeSpec;
  20. $this->timeValue = $timeValue;
  21. }
  22. /**
  23. * @return LifecycleAction
  24. */
  25. public function getAction()
  26. {
  27. return $this->action;
  28. }
  29. /**
  30. * @param string $action
  31. */
  32. public function setAction($action)
  33. {
  34. $this->action = $action;
  35. }
  36. /**
  37. * @return string
  38. */
  39. public function getTimeSpec()
  40. {
  41. return $this->timeSpec;
  42. }
  43. /**
  44. * @param string $timeSpec
  45. */
  46. public function setTimeSpec($timeSpec)
  47. {
  48. $this->timeSpec = $timeSpec;
  49. }
  50. /**
  51. * @return string
  52. */
  53. public function getTimeValue()
  54. {
  55. return $this->timeValue;
  56. }
  57. /**
  58. * @param string $timeValue
  59. */
  60. public function setTimeValue($timeValue)
  61. {
  62. $this->timeValue = $timeValue;
  63. }
  64. /**
  65. * Use appendToXml to insert actions into xml.
  66. *
  67. * @param \SimpleXMLElement $xmlRule
  68. */
  69. public function appendToXml(&$xmlRule)
  70. {
  71. $xmlAction = $xmlRule->addChild($this->action);
  72. $xmlAction->addChild($this->timeSpec, $this->timeValue);
  73. }
  74. private $action;
  75. private $timeSpec;
  76. private $timeValue;
  77. }