<?php
namespace AliyunMNS\Model;
use AliyunMNS\Constants;
class MessageAttributes
{
private $attributes;
public function __construct(
$attributes = NULL)
{
$this->attributes = $attributes;
}
public function setAttributes($attributes)
{
$this->attributes = $attributes;
}
public function getAttributes()
{
return $this->attributes;
}
public function writeXML(\XMLWriter $xmlWriter)
{
$xmlWriter->startELement(Constants::MESSAGE_ATTRIBUTES);
if ($this->attributes != NULL)
{
if (is_array($this->attributes))
{
foreach ($this->attributes as $subAttributes)
{
$subAttributes->writeXML($xmlWriter);
}
}
else
{
$this->attributes->writeXML($xmlWriter);
}
}
$xmlWriter->endElement();
}
}
?>