/**
  * Fill Encoding from array.
  *
  * @param array $options Array containing values for object properties
  */
 public function fromArray($options)
 {
     if (isset($options['AdMarkerSource'])) {
         Validate::isString($options['AdMarkerSource'], 'options[AdMarkerSource]');
         $this->_adMarkerSource = $options['AdMarkerSource'];
     }
     if (isset($options['IgnoreCea708ClosedCaptions'])) {
         Validate::isString($options['IgnoreCea708ClosedCaptions'], 'options[IgnoreCea708ClosedCaptions]');
         $this->_ignoreCea708ClosedCaptions = (bool) $options['IgnoreCea708ClosedCaptions'];
     }
     if (!empty($options['VideoStreams'])) {
         Validate::isArray($options['VideoStreams'], 'options[VideoStreams]');
         foreach ($options['VideoStreams'] as $videoStream) {
             $this->_videoStreams[] = VideoStream::createFromOptions($videoStream);
         }
     }
     if (!empty($options['AudioStreams'])) {
         Validate::isArray($options['AudioStreams'], 'options[AudioStreams]');
         foreach ($options['AudioStreams'] as $audioStream) {
             $this->_audioStreams[] = AudioStream::createFromOptions($audioStream);
         }
     }
     if (isset($options['SystemPreset'])) {
         Validate::isString($options['SystemPreset'], 'options[SystemPreset]');
         $this->_systemPreset = $options['SystemPreset'];
     }
 }
 private function makeChannelEncodingTypeStandard($name)
 {
     $channel = new Channel();
     $channel->setName($name);
     $channel->setDescription("Description of channel {$name}");
     // channel Input
     $channelInput = new ChannelInput();
     $channelInput->setStreamingProtocol(StreamingProtocol::RTPMPEG2TS);
     // channel Input\ChannelInputAccessControl
     $channelInputAccessControl = new ChannelInputAccessControl();
     $ciacIPAccessControl = new IPAccessControl();
     $ciacIPRange = new IPRange();
     $ciacIPRange->setName("default");
     $ciacIPRange->setAddress("0.0.0.0");
     $ciacIPRange->setSubnetPrefixLength("0");
     $ciacIPAccessControl->setAllow(array($ciacIPRange));
     $channelInputAccessControl->setIP($ciacIPAccessControl);
     $channelInput->setAccessControl($channelInputAccessControl);
     $channel->setInput($channelInput);
     // channel Preview
     $channelPreview = new ChannelPreview();
     // channel Preview\ChannelPreviewAccessControl
     $channelPreviewAccessControl = new ChannelPreviewAccessControl();
     $cpacIPAccessControl = new IPAccessControl();
     $cpacIPRange = new IPRange();
     $cpacIPRange->setName("default");
     $cpacIPRange->setAddress("0.0.0.0");
     $cpacIPRange->setSubnetPrefixLength("0");
     $cpacIPAccessControl->setAllow(array($cpacIPRange));
     $channelPreviewAccessControl->setIP($cpacIPAccessControl);
     $channelPreview->setAccessControl($channelPreviewAccessControl);
     $channel->setPreview($channelPreview);
     // encoding type
     $channel->setEncodingType(EncodingType::Standard);
     $channelEncoding = new ChannelEncoding();
     $channelEncoding->setSystemPreset(ChannelEncodingPresets::Default720p);
     $channelEncoding->setAdMarkerSource(AdMarkerSources::Scte35);
     $channelEncoding->setIgnoreCea708ClosedCaptions(true);
     $vs = new VideoStream();
     $vs->setIndex(0);
     $channelEncoding->setVideoStreams(array($vs));
     $as = new AudioStream();
     $as->setIndex(0);
     $as->setLanguage("eng");
     $channelEncoding->setAudioStreams(array($as));
     $channel->setEncoding($channelEncoding);
     // cors rules
     $channel->setCrossSiteAccessPolicies(new CrossSiteAccessPolicies());
     return $channel;
 }