private static function __getCloudFrontDistributionConfigXML($bucket, $enabled, $comment, $callerReference = '0', $cnames = array(), $defaultRootObject = null, $originAccessIdentity = null, $trustedSigners = array())
{
$dom = new DOMDocument('1.0', 'UTF-8');
$dom->formatOutput = true;
$distributionConfig = $dom->createElement('DistributionConfig');
$distributionConfig->setAttribute('xmlns', 'http://cloudfront.amazonaws.com/doc/2010-11-01/');
$origin = $dom->createElement('S3Origin');
$origin->appendChild($dom->createElement('DNSName', $bucket));
if ($originAccessIdentity !== null) {
$origin->appendChild($dom->createElement('OriginAccessIdentity', $originAccessIdentity));
}
$distributionConfig->appendChild($origin);
if ($defaultRootObject !== null) {
$distributionConfig->appendChild($dom->createElement('DefaultRootObject', $defaultRootObject));
}
$distributionConfig->appendChild($dom->createElement('CallerReference', $callerReference));
foreach ($cnames as $cname) {
$distributionConfig->appendChild($dom->createElement('CNAME', $cname));
}
if ($comment !== '') {
$distributionConfig->appendChild($dom->createElement('Comment', $comment));
}
$distributionConfig->appendChild($dom->createElement('Enabled', $enabled ? 'true' : 'false'));
$trusted = $dom->createElement('TrustedSigners');
foreach ($trustedSigners as $id => $type) {
$trusted->appendChild($id !== '' ? $dom->createElement($type, $id) : $dom->createElement($type));
}
$distributionConfig->appendChild($trusted);
$dom->appendChild($distributionConfig);
//var_dump($dom->saveXML());
return $dom->saveXML();
}