1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the KongAdminApi package. |
5
|
|
|
* |
6
|
|
|
* (c) Unikorp <https://github.com/unikorp> |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace Unikorp\KongAdminApi\Document; |
13
|
|
|
|
14
|
|
|
use Unikorp\KongAdminApi\AbstractDocument; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* api |
18
|
|
|
* |
19
|
|
|
* @author VEBER Arnaud <https://github.com/VEBERArnaud> |
20
|
|
|
*/ |
21
|
|
|
class Api extends AbstractDocument |
22
|
|
|
{ |
23
|
|
|
/** |
24
|
|
|
* name |
25
|
|
|
* @var string $name |
26
|
|
|
*/ |
27
|
|
|
protected $name = null; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* request host |
31
|
|
|
* @var string $requestHost |
32
|
|
|
*/ |
33
|
|
|
protected $requestHost = null; |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* request path |
37
|
|
|
* @var string $requestPath |
38
|
|
|
*/ |
39
|
|
|
protected $requestPath = null; |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* strip request path |
43
|
|
|
* @var bool $stripRequestPath |
44
|
|
|
*/ |
45
|
|
|
protected $stripRequestPath = false; |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* preserve host |
49
|
|
|
* @var bool $preserveHost |
50
|
|
|
*/ |
51
|
|
|
protected $preserveHost = false; |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* upstream url |
55
|
|
|
* @var string $upstreamUrl |
56
|
|
|
*/ |
57
|
|
|
protected $upstreamUrl = null; |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* set name |
61
|
|
|
* |
62
|
|
|
* @param string $name |
63
|
|
|
* |
64
|
|
|
* @return this |
65
|
|
|
*/ |
66
|
1 |
|
public function setName(string $name): self |
67
|
|
|
{ |
68
|
1 |
|
$this->name = $name; |
69
|
|
|
|
70
|
1 |
|
return $this; |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* get name |
75
|
|
|
* |
76
|
|
|
* @return string |
77
|
|
|
*/ |
78
|
1 |
|
public function getName(): string |
79
|
|
|
{ |
80
|
1 |
|
return $this->name; |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
/** |
84
|
|
|
* set request host |
85
|
|
|
* |
86
|
|
|
* @param string $requestHost |
87
|
|
|
* |
88
|
|
|
* @return this |
89
|
|
|
*/ |
90
|
1 |
|
public function setRequestHost(string $requestHost): self |
91
|
|
|
{ |
92
|
1 |
|
$this->requestHost = $requestHost; |
93
|
|
|
|
94
|
1 |
|
return $this; |
95
|
|
|
} |
96
|
|
|
|
97
|
|
|
/** |
98
|
|
|
* get request host |
99
|
|
|
* |
100
|
|
|
* @return string |
101
|
|
|
*/ |
102
|
1 |
|
public function getRequestHost(): string |
103
|
|
|
{ |
104
|
1 |
|
return $this->requestHost; |
105
|
|
|
} |
106
|
|
|
|
107
|
|
|
/** |
108
|
|
|
* set request path |
109
|
|
|
* |
110
|
|
|
* @param string $requestPath |
111
|
|
|
* |
112
|
|
|
* @return this |
113
|
|
|
*/ |
114
|
1 |
|
public function setRequestPath(string $requestPath): self |
115
|
|
|
{ |
116
|
1 |
|
$this->requestPath = $requestPath; |
117
|
|
|
|
118
|
1 |
|
return $this; |
119
|
|
|
} |
120
|
|
|
|
121
|
|
|
/** |
122
|
|
|
* get request path |
123
|
|
|
* |
124
|
|
|
* @return string |
125
|
|
|
*/ |
126
|
1 |
|
public function getRequestPath(): string |
127
|
|
|
{ |
128
|
1 |
|
return $this->requestPath; |
129
|
|
|
} |
130
|
|
|
|
131
|
|
|
/** |
132
|
|
|
* set strip request path |
133
|
|
|
* |
134
|
|
|
* @param bool $stripRequestPath |
135
|
|
|
* |
136
|
|
|
* @return this |
137
|
|
|
*/ |
138
|
1 |
|
public function setStripRequestPath(bool $stripRequestPath): self |
139
|
|
|
{ |
140
|
1 |
|
$this->stripRequestPath = $stripRequestPath; |
141
|
|
|
|
142
|
1 |
|
return $this; |
143
|
|
|
} |
144
|
|
|
|
145
|
|
|
/** |
146
|
|
|
* get strip request path |
147
|
|
|
* |
148
|
|
|
* @return bool |
149
|
|
|
*/ |
150
|
1 |
|
public function getStripRequestPath(): bool |
151
|
|
|
{ |
152
|
1 |
|
return $this->stripRequestPath; |
153
|
|
|
} |
154
|
|
|
|
155
|
|
|
/** |
156
|
|
|
* set preserve host |
157
|
|
|
* |
158
|
|
|
* @param bool $preserveHost |
159
|
|
|
* |
160
|
|
|
* @return this |
161
|
|
|
*/ |
162
|
1 |
|
public function setPreserveHost(bool $preserveHost): self |
163
|
|
|
{ |
164
|
1 |
|
$this->preserveHost = $preserveHost; |
165
|
|
|
|
166
|
1 |
|
return $this; |
167
|
|
|
} |
168
|
|
|
|
169
|
|
|
/** |
170
|
|
|
* get preserve host |
171
|
|
|
* |
172
|
|
|
* @return bool |
173
|
|
|
*/ |
174
|
1 |
|
public function getPreserveHost(): bool |
175
|
|
|
{ |
176
|
1 |
|
return $this->preserveHost; |
177
|
|
|
} |
178
|
|
|
|
179
|
|
|
/** |
180
|
|
|
* set upstream url |
181
|
|
|
* |
182
|
|
|
* @param string $upstreamUrl |
183
|
|
|
* |
184
|
|
|
* @return this |
185
|
|
|
*/ |
186
|
1 |
|
public function setUpstreamUrl(string $upstreamUrl): self |
187
|
|
|
{ |
188
|
1 |
|
$this->upstreamUrl = $upstreamUrl; |
189
|
|
|
|
190
|
1 |
|
return $this; |
191
|
|
|
} |
192
|
|
|
|
193
|
|
|
/** |
194
|
|
|
* get upstream url |
195
|
|
|
* |
196
|
|
|
* @return string |
197
|
|
|
*/ |
198
|
1 |
|
public function getUpstreamUrl(): string |
199
|
|
|
{ |
200
|
1 |
|
return $this->upstreamUrl; |
201
|
|
|
} |
202
|
|
|
|
203
|
|
|
/** |
204
|
|
|
* get fields |
205
|
|
|
* |
206
|
|
|
* @return array |
207
|
|
|
*/ |
208
|
1 |
|
protected function getFields(): array |
209
|
|
|
{ |
210
|
|
|
return [ |
211
|
1 |
|
'name', |
212
|
|
|
'requestHost', |
213
|
|
|
'requestPath', |
214
|
|
|
'stripRequestPath', |
215
|
|
|
'preserveHost', |
216
|
|
|
'upstreamUrl', |
217
|
|
|
]; |
218
|
|
|
} |
219
|
|
|
} |
220
|
|
|
|