1 | <?php |
||
25 | class Environment implements EnvironmentInterface |
||
26 | { |
||
27 | /** |
||
28 | * Expected query parameters type |
||
29 | * |
||
30 | * @var string|null |
||
31 | */ |
||
32 | protected $queryType; |
||
33 | |||
34 | /** |
||
35 | * Expected body content type |
||
36 | * |
||
37 | * @var string|null |
||
38 | */ |
||
39 | protected $bodyType; |
||
40 | |||
41 | /** |
||
42 | * Codec matcher configuration |
||
43 | * |
||
44 | * @var array |
||
45 | */ |
||
46 | protected $matcherConfiguration; |
||
47 | |||
48 | /** |
||
49 | * URLs prefix |
||
50 | * |
||
51 | * @var string |
||
52 | */ |
||
53 | protected $urlPrefix = ''; |
||
54 | |||
55 | /** |
||
56 | * Serialization groups |
||
57 | * |
||
58 | * @var string[] |
||
59 | */ |
||
60 | protected $serializationGroups = ['Default']; |
||
61 | |||
62 | /** |
||
63 | * Validation groups |
||
64 | * |
||
65 | * @var string[]|null |
||
66 | */ |
||
67 | protected $validationGroups; |
||
68 | |||
69 | /** |
||
70 | * Request decoder |
||
71 | * |
||
72 | * @var DecoderInterface|null |
||
73 | */ |
||
74 | protected $decoder; |
||
75 | |||
76 | /** |
||
77 | * Response encoder |
||
78 | * |
||
79 | * @var EncoderInterface|null |
||
80 | */ |
||
81 | protected $encoder; |
||
82 | |||
83 | /** |
||
84 | * Response encoder media type |
||
85 | * |
||
86 | * @var MediaTypeInterface|null |
||
87 | */ |
||
88 | protected $encoderMediaType; |
||
89 | |||
90 | /** |
||
91 | * Constructor |
||
92 | * |
||
93 | * @param array|null $config |
||
94 | */ |
||
95 | 4 | public function __construct(array $config = null) |
|
96 | { |
||
97 | 4 | if (null !== $config) { |
|
98 | $this->fromArray($config); |
||
99 | } |
||
100 | 4 | } |
|
101 | |||
102 | /** |
||
103 | * @inheritdoc |
||
104 | */ |
||
105 | 3 | public function getQueryType() |
|
109 | |||
110 | /** |
||
111 | * Sets expected query parameters type |
||
112 | * |
||
113 | * @param null|string $queryType |
||
114 | * @return $this |
||
115 | */ |
||
116 | 2 | public function setQueryType($queryType = null) |
|
122 | |||
123 | /** |
||
124 | * @inheritdoc |
||
125 | */ |
||
126 | 3 | public function getBodyType() |
|
130 | |||
131 | /** |
||
132 | * Sets expected body content type |
||
133 | * |
||
134 | * @param null|string $bodyType |
||
135 | * @return $this |
||
136 | */ |
||
137 | 1 | public function setBodyType($bodyType = null) |
|
143 | |||
144 | /** |
||
145 | * @inheritdoc |
||
146 | */ |
||
147 | 4 | public function getMatcherConfiguration() |
|
151 | |||
152 | /** |
||
153 | * Sets codec matcher configuration |
||
154 | * |
||
155 | * @param array $matcherConfiguration |
||
156 | * @return $this |
||
157 | */ |
||
158 | 4 | public function setMatcherConfiguration(array $matcherConfiguration) |
|
164 | |||
165 | /** |
||
166 | * @inheritdoc |
||
167 | */ |
||
168 | public function getUrlPrefix() |
||
169 | { |
||
170 | return $this->urlPrefix; |
||
171 | } |
||
172 | |||
173 | /** |
||
174 | * Sets URLs prefix |
||
175 | * |
||
176 | * @param string $urlPrefix |
||
177 | * @return $this |
||
178 | */ |
||
179 | 1 | public function setUrlPrefix($urlPrefix) |
|
185 | |||
186 | /** |
||
187 | * @return string[] |
||
188 | */ |
||
189 | 3 | public function getSerializationGroups() |
|
193 | |||
194 | /** |
||
195 | * @param string[] $serializationGroups |
||
196 | * @return $this |
||
197 | */ |
||
198 | public function setSerializationGroups(array $serializationGroups) |
||
199 | { |
||
200 | $this->serializationGroups = $serializationGroups; |
||
201 | |||
202 | return $this; |
||
203 | } |
||
204 | |||
205 | /** |
||
206 | * @inheritdoc |
||
207 | */ |
||
208 | 3 | public function getValidationGroups() |
|
212 | |||
213 | /** |
||
214 | * Sets validation groups |
||
215 | * |
||
216 | * @param array|null $validationGroups |
||
217 | * @return $this |
||
218 | */ |
||
219 | 3 | public function setValidationGroups(array $validationGroups = null) |
|
225 | |||
226 | /** |
||
227 | * @inheritdoc |
||
228 | */ |
||
229 | 1 | public function getEncoder() |
|
233 | |||
234 | /** |
||
235 | * Sets response encoder |
||
236 | * |
||
237 | * @param EncoderInterface $encoder |
||
238 | * @return $this |
||
239 | */ |
||
240 | 3 | public function setEncoder(EncoderInterface $encoder) |
|
246 | |||
247 | /** |
||
248 | * @inheritdoc |
||
249 | */ |
||
250 | 1 | public function getEncoderMediaType() |
|
254 | |||
255 | /** |
||
256 | * Sets response encoder media type |
||
257 | * |
||
258 | * @param MediaTypeInterface $encoderMediaType |
||
259 | * @return $this |
||
260 | */ |
||
261 | 3 | public function setEncoderMediaType(MediaTypeInterface $encoderMediaType) |
|
267 | |||
268 | /** |
||
269 | * @inheritdoc |
||
270 | */ |
||
271 | 3 | public function setDecoder(DecoderInterface $decoder) |
|
277 | |||
278 | /** |
||
279 | * @inheritdoc |
||
280 | */ |
||
281 | 1 | public function getDecoder() |
|
285 | |||
286 | /** |
||
287 | * Sets environment configuration from array |
||
288 | * |
||
289 | * @param array $config |
||
290 | */ |
||
291 | protected function fromArray(array $config) |
||
310 | } |
||
311 |