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
|
|
|
use Superdesk\ContentApiSdk\Api\Request\RequestParameters; |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* Base decorator class for API Requests. |
21
|
|
|
*/ |
22
|
|
|
class RequestDecorator implements RequestInterface |
23
|
|
|
{ |
24
|
|
|
/** |
25
|
|
|
* @var RequestInterface |
26
|
|
|
*/ |
27
|
|
|
protected $decoratedRequest; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* Intialize object. |
31
|
|
|
* |
32
|
|
|
* @param RequestInterface $requestInterface |
33
|
|
|
*/ |
34
|
|
|
public function __construct(RequestInterface $requestInterface) |
35
|
|
|
{ |
36
|
|
|
$this->decoratedRequest = $requestInterface; |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* {@inheritdoc} |
41
|
|
|
*/ |
42
|
|
|
public function getProtocol() |
43
|
|
|
{ |
44
|
|
|
return $this->decoratedRequest->getProtocol(); |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* {@inheritdoc} |
49
|
|
|
*/ |
50
|
|
|
public function setProtocol($protocol) |
51
|
|
|
{ |
52
|
|
|
$this->decoratedRequest->setProtocol($protocol); |
53
|
|
|
|
54
|
|
|
return $this; |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* {@inheritdoc} |
59
|
|
|
*/ |
60
|
|
|
public function getHost() |
61
|
|
|
{ |
62
|
|
|
return $this->decoratedRequest->getHost(); |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* {@inheritdoc} |
67
|
|
|
*/ |
68
|
|
|
public function setHost($host) |
69
|
|
|
{ |
70
|
|
|
$this->decoratedRequest->setHost($host); |
71
|
|
|
|
72
|
|
|
return $this; |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
/** |
76
|
|
|
* {@inheritdoc} |
77
|
|
|
*/ |
78
|
|
|
public function getPort() |
79
|
|
|
{ |
80
|
|
|
return $this->decoratedRequest->getPort(); |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
/** |
84
|
|
|
* {@inheritdoc} |
85
|
|
|
*/ |
86
|
|
|
public function setPort($port) |
87
|
|
|
{ |
88
|
|
|
$this->decoratedRequest->setPort($port); |
89
|
|
|
|
90
|
|
|
return $this; |
91
|
|
|
} |
92
|
|
|
|
93
|
|
|
/** |
94
|
|
|
* {@inheritdoc} |
95
|
|
|
*/ |
96
|
|
|
public function getUri() |
97
|
|
|
{ |
98
|
|
|
return $this->decoratedRequest->getUri(); |
99
|
|
|
} |
100
|
|
|
|
101
|
|
|
/** |
102
|
|
|
* {@inheritdoc} |
103
|
|
|
*/ |
104
|
|
|
public function setUri($uri) |
105
|
|
|
{ |
106
|
|
|
$this->decoratedRequest->setUri($uri); |
107
|
|
|
|
108
|
|
|
return $this; |
109
|
|
|
} |
110
|
|
|
|
111
|
|
|
/** |
112
|
|
|
* {@inheritdoc} |
113
|
|
|
*/ |
114
|
|
|
public function getParameters() |
115
|
|
|
{ |
116
|
|
|
return $this->decoratedRequest->getParameters(); |
117
|
|
|
} |
118
|
|
|
|
119
|
|
|
/** |
120
|
|
|
* {@inheritdoc} |
121
|
|
|
*/ |
122
|
|
|
public function setParameters(RequestParameters $parameters) |
123
|
|
|
{ |
124
|
|
|
$this->decoratedRequest->setParameters($parameters); |
125
|
|
|
|
126
|
|
|
return $this; |
127
|
|
|
} |
128
|
|
|
|
129
|
|
|
/** |
130
|
|
|
* {@inheritdoc} |
131
|
|
|
*/ |
132
|
|
|
public function getHeaders() |
133
|
|
|
{ |
134
|
|
|
return $this->decoratedRequest->getHeaders(); |
135
|
|
|
} |
136
|
|
|
|
137
|
|
|
/** |
138
|
|
|
* {@inheritdoc} |
139
|
|
|
*/ |
140
|
|
|
public function setHeaders(array $headers) |
141
|
|
|
{ |
142
|
|
|
$this->decoratedRequest->setHeaders($headers); |
143
|
|
|
|
144
|
|
|
return $this; |
145
|
|
|
} |
146
|
|
|
|
147
|
|
|
/** |
148
|
|
|
* {@inheritdoc} |
149
|
|
|
*/ |
150
|
|
|
public function getOptions() |
151
|
|
|
{ |
152
|
|
|
return $this->decoratedRequest->getOptions(); |
153
|
|
|
} |
154
|
|
|
|
155
|
|
|
/** |
156
|
|
|
* {@inheritdoc} |
157
|
|
|
*/ |
158
|
|
|
public function setOptions(array $options) |
159
|
|
|
{ |
160
|
|
|
$this->decoratedRequest->setOptions($options); |
161
|
|
|
|
162
|
|
|
return $this; |
163
|
|
|
} |
164
|
|
|
|
165
|
|
|
/** |
166
|
|
|
* {@inheritdoc} |
167
|
|
|
*/ |
168
|
|
|
public function getBaseUrl() |
169
|
|
|
{ |
170
|
|
|
return $this->decoratedRequest->getBaseUrl(); |
171
|
|
|
} |
172
|
|
|
|
173
|
|
|
/** |
174
|
|
|
* {@inheritdoc} |
175
|
|
|
*/ |
176
|
|
|
public function getFullUrl() |
177
|
|
|
{ |
178
|
|
|
return $this->decoratedRequest->getFullUrl(); |
179
|
|
|
} |
180
|
|
|
} |
181
|
|
|
|