MessageAttributes.php
1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
namespace AliyunMNS\Model;
use AliyunMNS\Constants;
/**
* Please refer to
* https://docs.aliyun.com/?spm=#/pub/mns/api_reference/intro&intro
* for more details
*/
class MessageAttributes
{
// if both SmsAttributes and BatchSmsAttributes are set, only one will take effect
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();
}
}
?>