S3::__getCloudFrontDistributionConfigXML PHP Method

__getCloudFrontDistributionConfigXML() private static method

http://docs.amazonwebservices.com/AmazonCloudFront/latest/APIReference/index.html?PutConfig.html
private static __getCloudFrontDistributionConfigXML ( string $bucket, boolean $enabled, string $comment, string $callerReference = '0', array $cnames = [], string $defaultRootObject = null, string $originAccessIdentity = null, array $trustedSigners = [] ) : string
$bucket string S3 Origin bucket
$enabled boolean Enabled (true/false)
$comment string Comment to append
$callerReference string Caller reference
$cnames array Array of CNAME aliases
$defaultRootObject string Default root object
$originAccessIdentity string Origin access identity
$trustedSigners array Array of trusted signers
return string
    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();
    }