1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* This file is part of the PHP SDK library for the Superdesk Content API. |
5
|
|
|
* |
6
|
|
|
* Copyright 2015 Sourcefabric z.u. and contributors. |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please see the |
9
|
|
|
* AUTHORS and LICENSE files distributed with this source code. |
10
|
|
|
* |
11
|
|
|
* @copyright 2015 Sourcefabric z.ú. |
12
|
|
|
* @license http://www.superdesk.org/license |
13
|
|
|
*/ |
14
|
|
|
|
15
|
|
|
namespace Superdesk\ContentApiSdk\API\Request; |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* Base decorator class for API Requests. |
19
|
|
|
*/ |
20
|
|
|
class RequestDecorator implements RequestInterface |
21
|
|
|
{ |
22
|
|
|
/** |
23
|
|
|
* @var RequestInterface |
24
|
|
|
*/ |
25
|
|
|
protected $decoratedRequest; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* Intialize object. |
29
|
|
|
* |
30
|
|
|
* @param RequestInterface $requestInterface |
31
|
|
|
*/ |
32
|
|
|
public function __construct(RequestInterface $requestInterface) |
33
|
|
|
{ |
34
|
|
|
$this->decoratedRequest = $requestInterface; |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* {@inheritdoc} |
39
|
|
|
*/ |
40
|
|
|
public function getHost() |
41
|
|
|
{ |
42
|
|
|
return $this->decoratedRequest->getHost(); |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* {@inheritdoc} |
47
|
|
|
*/ |
48
|
|
|
public function setHost($host) |
49
|
|
|
{ |
50
|
|
|
$this->decoratedRequest->setHost($host); |
51
|
|
|
|
52
|
|
|
return $this; |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* {@inheritdoc} |
57
|
|
|
*/ |
58
|
|
|
public function getPort() |
59
|
|
|
{ |
60
|
|
|
return $this->decoratedRequest->getPort(); |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* {@inheritdoc} |
65
|
|
|
*/ |
66
|
|
|
public function setPort($port) |
67
|
|
|
{ |
68
|
|
|
$this->decoratedRequest->setPort($port); |
69
|
|
|
|
70
|
|
|
return $this; |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* {@inheritdoc} |
75
|
|
|
*/ |
76
|
|
|
public function getUri() |
77
|
|
|
{ |
78
|
|
|
return $this->decoratedRequest->getUri(); |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
/** |
82
|
|
|
* {@inheritdoc} |
83
|
|
|
*/ |
84
|
|
|
public function setUri($uri) |
85
|
|
|
{ |
86
|
|
|
$this->decoratedRequest->setUri($uri); |
87
|
|
|
|
88
|
|
|
return $this; |
89
|
|
|
} |
90
|
|
|
|
91
|
|
|
/** |
92
|
|
|
* {@inheritdoc} |
93
|
|
|
*/ |
94
|
|
|
public function getParameters() |
95
|
|
|
{ |
96
|
|
|
return $this->decoratedRequest->getParameters(); |
97
|
|
|
} |
98
|
|
|
|
99
|
|
|
/** |
100
|
|
|
* {@inheritdoc} |
101
|
|
|
*/ |
102
|
|
|
public function setParameters(array $parameters) |
103
|
|
|
{ |
104
|
|
|
$this->decoratedRequest->setParameters($parameters); |
105
|
|
|
|
106
|
|
|
return $this; |
107
|
|
|
} |
108
|
|
|
|
109
|
|
|
/** |
110
|
|
|
* {@inheritdoc} |
111
|
|
|
*/ |
112
|
|
|
public function getCleanParameters() |
113
|
|
|
{ |
114
|
|
|
return $this->decoratedRequest->getCleanParameters(); |
115
|
|
|
} |
116
|
|
|
|
117
|
|
|
/** |
118
|
|
|
* {@inheritdoc} |
119
|
|
|
*/ |
120
|
|
|
public function enableParameterCleaning() |
121
|
|
|
{ |
122
|
|
|
$this->decoratedRequest->enableParameterCleaning(); |
123
|
|
|
|
124
|
|
|
return $this; |
125
|
|
|
} |
126
|
|
|
|
127
|
|
|
/** |
128
|
|
|
* {@inheritdoc} |
129
|
|
|
*/ |
130
|
|
|
public function disableParameterCleaning() |
131
|
|
|
{ |
132
|
|
|
$this->decoratedRequest->disableParameterCleaning(); |
133
|
|
|
|
134
|
|
|
return $this; |
135
|
|
|
} |
136
|
|
|
|
137
|
|
|
/** |
138
|
|
|
* {@inheritdoc} |
139
|
|
|
*/ |
140
|
|
|
public function getHeaders() |
141
|
|
|
{ |
142
|
|
|
return $this->decoratedRequest->getHeaders(); |
143
|
|
|
} |
144
|
|
|
|
145
|
|
|
/** |
146
|
|
|
* {@inheritdoc} |
147
|
|
|
*/ |
148
|
|
|
public function setHeaders(array $headers) |
149
|
|
|
{ |
150
|
|
|
$this->decoratedRequest->setHeaders($headers); |
151
|
|
|
|
152
|
|
|
return $this; |
153
|
|
|
} |
154
|
|
|
|
155
|
|
|
/** |
156
|
|
|
* {@inheritdoc} |
157
|
|
|
*/ |
158
|
|
|
public function getOptions() |
159
|
|
|
{ |
160
|
|
|
return $this->decoratedRequest->getOptions(); |
161
|
|
|
} |
162
|
|
|
|
163
|
|
|
/** |
164
|
|
|
* {@inheritdoc} |
165
|
|
|
*/ |
166
|
|
|
public function setOptions(array $options) |
167
|
|
|
{ |
168
|
|
|
$this->decoratedRequest->setOptions($options); |
169
|
|
|
|
170
|
|
|
return $this; |
171
|
|
|
} |
172
|
|
|
|
173
|
|
|
/** |
174
|
|
|
* {@inheritdoc} |
175
|
|
|
*/ |
176
|
|
|
public function getBaseUrl() |
177
|
|
|
{ |
178
|
|
|
return $this->decoratedRequest->getBaseUrl(); |
179
|
|
|
} |
180
|
|
|
|
181
|
|
|
/** |
182
|
|
|
* {@inheritdoc} |
183
|
|
|
*/ |
184
|
|
|
public function getFullUrl() |
185
|
|
|
{ |
186
|
|
|
return $this->decoratedRequest->getFullUrl(); |
187
|
|
|
} |
188
|
|
|
} |
189
|
|
|
|