|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Openpp\NotificationHubsRest\Registration; |
|
4
|
|
|
|
|
5
|
|
|
class WindowsRegistration extends AbstractRegistration |
|
6
|
|
|
{ |
|
7
|
|
|
/** |
|
8
|
|
|
* @var string |
|
9
|
|
|
*/ |
|
10
|
|
|
protected $wnsType; |
|
11
|
|
|
|
|
12
|
|
|
/** |
|
13
|
|
|
* @var string |
|
14
|
|
|
*/ |
|
15
|
|
|
protected $wnsTag; |
|
16
|
|
|
|
|
17
|
|
|
/** |
|
18
|
|
|
* {@inheritdoc} |
|
19
|
|
|
*/ |
|
20
|
|
|
public function getRegistrationDescriptionTag() |
|
21
|
|
|
{ |
|
22
|
|
|
return 'WindowsRegistrationDescription'; |
|
23
|
|
|
} |
|
24
|
|
|
|
|
25
|
|
|
/** |
|
26
|
|
|
* {@inheritdoc} |
|
27
|
|
|
*/ |
|
28
|
|
|
public function getTemplateRegistrationDescriptionTag() |
|
29
|
|
|
{ |
|
30
|
|
|
return 'WindowsTemplateRegistrationDescription'; |
|
31
|
|
|
} |
|
32
|
|
|
|
|
33
|
|
|
/** |
|
34
|
|
|
* {@inheritdoc} |
|
35
|
|
|
*/ |
|
36
|
|
|
public function getTokenTag() |
|
37
|
|
|
{ |
|
38
|
|
|
return 'ChannelUri'; |
|
39
|
|
|
} |
|
40
|
|
|
|
|
41
|
|
|
/** |
|
42
|
|
|
* Sets the X-WNS-Type header value. |
|
43
|
|
|
* |
|
44
|
|
|
* @param string $wnsType |
|
45
|
|
|
* |
|
46
|
|
|
* @return WindowsRegistration this object |
|
47
|
|
|
*/ |
|
48
|
|
|
public function setWnsType($wnsType) |
|
49
|
|
|
{ |
|
50
|
|
|
$this->wnsType = $wnsType; |
|
51
|
|
|
|
|
52
|
|
|
return $this; |
|
53
|
|
|
} |
|
54
|
|
|
|
|
55
|
|
|
/** |
|
56
|
|
|
* Sets the X-WNS-Tag header value. |
|
57
|
|
|
* |
|
58
|
|
|
* @param string $wnsTag |
|
59
|
|
|
* |
|
60
|
|
|
* @return WindowsRegistration this object |
|
61
|
|
|
*/ |
|
62
|
|
|
public function setWnsTag($wnsTag) |
|
63
|
|
|
{ |
|
64
|
|
|
$this->wnsTag = $wnsTag; |
|
65
|
|
|
|
|
66
|
|
|
return $this; |
|
67
|
|
|
} |
|
68
|
|
|
|
|
69
|
|
|
/** |
|
70
|
|
|
* {@inheritdoc} |
|
71
|
|
|
*/ |
|
72
|
|
|
protected function appendAdditionalNode($descriptionNode) |
|
73
|
|
|
{ |
|
74
|
|
|
if ($this->template) { |
|
75
|
|
|
$wnsHeadersElement = $this->dom->createElement('WnsHeaders'); |
|
76
|
|
|
$wnsHeader = $this->dom->createElement('WnsHeader'); |
|
77
|
|
|
$wnsHeader->appendChild($this->dom->createElement('Header', 'X-WNS-Type')); |
|
78
|
|
|
$wnsHeader->appendChild($this->dom->createElement('Value', $this->wnsType)); |
|
79
|
|
|
$wnsHeadersElement->appendChild($wnsHeader); |
|
80
|
|
|
|
|
81
|
|
|
if ($this->wnsTag) { |
|
82
|
|
|
$wnsHeader = $this->dom->createElement('WnsHeader'); |
|
83
|
|
|
$wnsHeader->appendChild($this->dom->createElement('Header', 'X-WNS-Tag')); |
|
84
|
|
|
$wnsHeader->appendChild($this->dom->createElement('Value', $this->wnsTag)); |
|
85
|
|
|
$wnsHeadersElement->appendChild($wnsHeader); |
|
86
|
|
|
} |
|
87
|
|
|
|
|
88
|
|
|
$descriptionNode->appendChild($wnsHeadersElement); |
|
89
|
|
|
} |
|
90
|
|
|
} |
|
91
|
|
|
} |
|
92
|
|
|
|