OSS\Model\LiveChannelConfig::parseFromXml PHP Метод

parseFromXml() публичный Метод

public parseFromXml ( $strXml )
    public function parseFromXml($strXml)
    {
        $xml = simplexml_load_string($strXml);
        $this->description = strval($xml->Description);
        $this->status = strval($xml->Status);
        $target = $xml->Target;
        $this->type = strval($target->Type);
        $this->fragDuration = intval($target->FragDuration);
        $this->fragCount = intval($target->FragCount);
        $this->playListName = strval($target->PlayListName);
    }

Usage Example

 public function testLiveChannelConfig()
 {
     $config = new LiveChannelConfig(array('name' => 'live-1'));
     $config->parseFromXml($this->config);
     $this->assertEquals('xxx', $config->getDescription());
     $this->assertEquals('enabled', $config->getStatus());
     $this->assertEquals('hls', $config->getType());
     $this->assertEquals(1000, $config->getFragDuration());
     $this->assertEquals(5, $config->getFragCount());
     $this->assertEquals('hello.m3u8', $config->getPlayListName());
     $xml = $config->serializeToXml();
     $config2 = new LiveChannelConfig(array('name' => 'live-2'));
     $config2->parseFromXml($xml);
     $this->assertEquals('xxx', $config2->getDescription());
     $this->assertEquals('enabled', $config2->getStatus());
     $this->assertEquals('hls', $config2->getType());
     $this->assertEquals(1000, $config2->getFragDuration());
     $this->assertEquals(5, $config2->getFragCount());
     $this->assertEquals('hello.m3u8', $config2->getPlayListName());
 }