Total Complexity | 7 |
Total Lines | 39 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
11 | class MessageAttributes |
||
12 | { |
||
13 | // if both SmsAttributes and BatchSmsAttributes are set, only one will take effect |
||
14 | private $attributes; |
||
15 | |||
16 | public function __construct( |
||
17 | $attributes = NULL) |
||
18 | { |
||
19 | $this->attributes = $attributes; |
||
20 | } |
||
21 | |||
22 | public function setAttributes($attributes) |
||
23 | { |
||
24 | $this->attributes = $attributes; |
||
25 | } |
||
26 | |||
27 | public function getAttributes() |
||
28 | { |
||
29 | return $this->attributes; |
||
30 | } |
||
31 | |||
32 | public function writeXML(\XMLWriter $xmlWriter) |
||
33 | { |
||
34 | $xmlWriter->startELement(Constants::MESSAGE_ATTRIBUTES); |
||
35 | if ($this->attributes != NULL) |
||
36 | { |
||
37 | if (is_array($this->attributes)) |
||
38 | { |
||
39 | foreach ($this->attributes as $subAttributes) |
||
40 | { |
||
41 | $subAttributes->writeXML($xmlWriter); |
||
42 | } |
||
43 | } |
||
44 | else |
||
45 | { |
||
46 | $this->attributes->writeXML($xmlWriter); |
||
47 | } |
||
48 | } |
||
49 | $xmlWriter->endElement(); |
||
50 | } |
||
54 |