1 | <?php |
||
18 | class MPNSRaw extends MPNSBase |
||
19 | { |
||
20 | const MESSAGE_TYPE = 'raw'; |
||
21 | |||
22 | const DELAY_INTERVAL_IMMEDIATE = 3; |
||
23 | const DELAY_INTERVAL_450 = 13; |
||
24 | const DELAY_INTERVAL_900 = 23; |
||
25 | |||
26 | /** |
||
27 | * Custom payload parameters |
||
28 | * |
||
29 | * @var array |
||
30 | */ |
||
31 | private $_payload; |
||
32 | |||
33 | /** |
||
34 | * @param array $data |
||
35 | */ |
||
36 | public function __construct(array $data = array()) |
||
47 | |||
48 | /** |
||
49 | * {@inheritdoc} |
||
50 | */ |
||
51 | public function createPayload() |
||
52 | { |
||
53 | $message = new \DOMDocument("1.0", "utf-8"); |
||
54 | $baseElement = $message->createElement("wp:Notification"); |
||
55 | $baseElement->setAttribute("xmlns:wp", "WPNotification"); |
||
56 | $message->appendChild($baseElement); |
||
57 | |||
58 | $rootElement = $message->createElement("root"); |
||
59 | $baseElement->appendChild($rootElement); |
||
60 | |||
61 | foreach ($this->_payload as $key => $value) { |
||
62 | $element = $message->createElement($key, $value); |
||
63 | $rootElement->appendChild($element); |
||
64 | } |
||
65 | |||
66 | return $message; |
||
67 | } |
||
68 | |||
69 | /** |
||
70 | * @param string $name |
||
71 | */ |
||
72 | public function __get($name) |
||
80 | |||
81 | /** |
||
82 | * @param string $name |
||
83 | * @param mixed $value |
||
84 | */ |
||
85 | public function __set($name, $value) |
||
89 | } |
||
90 |