LiveChannelInfo.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. <?php
  2. namespace OSS\Model;
  3. /**
  4. * Class LiveChannelInfo
  5. * @package OSS\Model
  6. *
  7. */
  8. class LiveChannelInfo implements XmlConfig
  9. {
  10. public function __construct($name = null, $description = null)
  11. {
  12. $this->name = $name;
  13. $this->description = $description;
  14. $this->publishUrls = array();
  15. $this->playUrls = array();
  16. }
  17. public function getName()
  18. {
  19. return $this->name;
  20. }
  21. public function setName($name)
  22. {
  23. $this->name = $name;
  24. }
  25. public function getPublishUrls()
  26. {
  27. return $this->publishUrls;
  28. }
  29. public function getPlayUrls()
  30. {
  31. return $this->playUrls;
  32. }
  33. public function getStatus()
  34. {
  35. return $this->status;
  36. }
  37. public function getLastModified()
  38. {
  39. return $this->lastModified;
  40. }
  41. public function getDescription()
  42. {
  43. return $this->description;
  44. }
  45. public function setDescription($description)
  46. {
  47. $this->description = $description;
  48. }
  49. public function parseFromXmlNode($xml)
  50. {
  51. if (isset($xml->Name)) {
  52. $this->name = strval($xml->Name);
  53. }
  54. if (isset($xml->Description)) {
  55. $this->description = strval($xml->Description);
  56. }
  57. if (isset($xml->Status)) {
  58. $this->status = strval($xml->Status);
  59. }
  60. if (isset($xml->LastModified)) {
  61. $this->lastModified = strval($xml->LastModified);
  62. }
  63. if (isset($xml->PublishUrls)) {
  64. foreach ($xml->PublishUrls as $url) {
  65. $this->publishUrls[] = strval($url->Url);
  66. }
  67. }
  68. if (isset($xml->PlayUrls)) {
  69. foreach ($xml->PlayUrls as $url) {
  70. $this->playUrls[] = strval($url->Url);
  71. }
  72. }
  73. }
  74. public function parseFromXml($strXml)
  75. {
  76. $xml = simplexml_load_string($strXml);
  77. $this->parseFromXmlNode($xml);
  78. }
  79. public function serializeToXml()
  80. {
  81. throw new OssException("Not implemented.");
  82. }
  83. private $name;
  84. private $description;
  85. private $publishUrls;
  86. private $playUrls;
  87. private $status;
  88. private $lastModified;
  89. }