1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* This file is part of the Ssdp project. |
4
|
|
|
* |
5
|
|
|
* @author Daniel Schröder <[email protected]> |
6
|
|
|
*/ |
7
|
|
|
|
8
|
|
|
namespace GravityMedia\Ssdp; |
9
|
|
|
|
10
|
|
|
use Psr\Http\Message\UriInterface; |
11
|
|
|
|
12
|
|
|
/** |
13
|
|
|
* Message class |
14
|
|
|
* |
15
|
|
|
* @package GravityMedia\Ssdp |
16
|
|
|
*/ |
17
|
|
|
class Message |
18
|
|
|
{ |
19
|
|
|
/** |
20
|
|
|
* @var int |
21
|
|
|
*/ |
22
|
|
|
protected $lifetime; |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* @var \DateTimeInterface |
26
|
|
|
*/ |
27
|
|
|
protected $date; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* @var UriInterface |
31
|
|
|
*/ |
32
|
|
|
protected $descriptionUrl; |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* @var string |
36
|
|
|
*/ |
37
|
|
|
protected $serverString; |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* @var string |
41
|
|
|
*/ |
42
|
|
|
protected $searchTargetString; |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* @var string |
46
|
|
|
*/ |
47
|
|
|
protected $uniqueServiceNameString; |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* Get lifetime |
51
|
|
|
* |
52
|
|
|
* @return int |
53
|
|
|
*/ |
54
|
|
|
public function getLifetime() |
55
|
|
|
{ |
56
|
|
|
return $this->lifetime; |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* Set lifetime |
61
|
|
|
* |
62
|
|
|
* @param int $lifetime |
63
|
|
|
* |
64
|
|
|
* @return $this |
65
|
|
|
*/ |
66
|
|
|
public function setLifetime($lifetime) |
67
|
|
|
{ |
68
|
|
|
$this->lifetime = $lifetime; |
69
|
|
|
return $this; |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* Get date |
74
|
|
|
* |
75
|
|
|
* @return \DateTimeInterface |
76
|
|
|
*/ |
77
|
|
|
public function getDate() |
78
|
|
|
{ |
79
|
|
|
return $this->date; |
80
|
|
|
} |
81
|
|
|
|
82
|
|
|
/** |
83
|
|
|
* Set date |
84
|
|
|
* |
85
|
|
|
* @param \DateTimeInterface $date |
86
|
|
|
* |
87
|
|
|
* @return $this |
88
|
|
|
*/ |
89
|
|
|
public function setDate(\DateTimeInterface $date) |
90
|
|
|
{ |
91
|
|
|
$this->date = $date; |
92
|
|
|
return $this; |
93
|
|
|
} |
94
|
|
|
|
95
|
|
|
/** |
96
|
|
|
* Get description URL |
97
|
|
|
* |
98
|
|
|
* @return UriInterface |
99
|
|
|
*/ |
100
|
|
|
public function getDescriptionUrl() |
101
|
|
|
{ |
102
|
|
|
return $this->descriptionUrl; |
103
|
|
|
} |
104
|
|
|
|
105
|
|
|
/** |
106
|
|
|
* Set description URL |
107
|
|
|
* |
108
|
|
|
* @param UriInterface $descriptionUrl |
109
|
|
|
* |
110
|
|
|
* @return $this |
111
|
|
|
*/ |
112
|
|
|
public function setDescriptionUrl(UriInterface $descriptionUrl) |
113
|
|
|
{ |
114
|
|
|
$this->descriptionUrl = $descriptionUrl; |
115
|
|
|
return $this; |
116
|
|
|
} |
117
|
|
|
|
118
|
|
|
/** |
119
|
|
|
* Get server string |
120
|
|
|
* |
121
|
|
|
* @return string |
122
|
|
|
*/ |
123
|
|
|
public function getServerString() |
124
|
|
|
{ |
125
|
|
|
return $this->serverString; |
126
|
|
|
} |
127
|
|
|
|
128
|
|
|
/** |
129
|
|
|
* Set server string |
130
|
|
|
* |
131
|
|
|
* @param string $serverString |
132
|
|
|
* |
133
|
|
|
* @return $this |
134
|
|
|
*/ |
135
|
|
|
public function setServerString($serverString) |
136
|
|
|
{ |
137
|
|
|
$this->serverString = $serverString; |
138
|
|
|
return $this; |
139
|
|
|
} |
140
|
|
|
|
141
|
|
|
/** |
142
|
|
|
* Get search target |
143
|
|
|
* |
144
|
|
|
* @return string |
145
|
|
|
*/ |
146
|
|
|
public function getSearchTargetString() |
147
|
|
|
{ |
148
|
|
|
return $this->searchTargetString; |
149
|
|
|
} |
150
|
|
|
|
151
|
|
|
/** |
152
|
|
|
* Set search target |
153
|
|
|
* |
154
|
|
|
* @param string $searchTargetString |
155
|
|
|
* |
156
|
|
|
* @return $this |
157
|
|
|
*/ |
158
|
|
|
public function setSearchTargetString($searchTargetString) |
159
|
|
|
{ |
160
|
|
|
$this->searchTargetString = $searchTargetString; |
161
|
|
|
return $this; |
162
|
|
|
} |
163
|
|
|
|
164
|
|
|
/** |
165
|
|
|
* Get unique service name |
166
|
|
|
* |
167
|
|
|
* @return string |
168
|
|
|
*/ |
169
|
|
|
public function getUniqueServiceNameString() |
170
|
|
|
{ |
171
|
|
|
return $this->uniqueServiceNameString; |
172
|
|
|
} |
173
|
|
|
|
174
|
|
|
/** |
175
|
|
|
* Set unique service name |
176
|
|
|
* |
177
|
|
|
* @param string $uniqueServiceNameString |
178
|
|
|
* |
179
|
|
|
* @return $this |
180
|
|
|
*/ |
181
|
|
|
public function setUniqueServiceNameString($uniqueServiceNameString) |
182
|
|
|
{ |
183
|
|
|
$this->uniqueServiceNameString = $uniqueServiceNameString; |
184
|
|
|
return $this; |
185
|
|
|
} |
186
|
|
|
} |
187
|
|
|
|