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 | 6 | protected $encoderMediaType; |
|
89 | |||
90 | 6 | /** |
|
91 | 2 | * Constructor |
|
92 | 2 | * |
|
93 | 6 | * @param array|null $config |
|
94 | */ |
||
95 | public function __construct(array $config = null) |
||
101 | |||
102 | /** |
||
103 | * @inheritdoc |
||
104 | */ |
||
105 | public function getQueryType() |
||
109 | 3 | ||
110 | /** |
||
111 | 3 | * Sets expected query parameters type |
|
112 | * |
||
113 | 3 | * @param null|string $queryType |
|
114 | * @return $this |
||
115 | */ |
||
116 | public function setQueryType($queryType = null) |
||
122 | |||
123 | /** |
||
124 | * @inheritdoc |
||
125 | */ |
||
126 | public function getBodyType() |
||
130 | 2 | ||
131 | /** |
||
132 | 2 | * Sets expected body content type |
|
133 | * |
||
134 | 2 | * @param null|string $bodyType |
|
135 | * @return $this |
||
136 | */ |
||
137 | public function setBodyType($bodyType = null) |
||
143 | |||
144 | /** |
||
145 | * @inheritdoc |
||
146 | */ |
||
147 | public function getMatcherConfiguration() |
||
151 | 6 | ||
152 | /** |
||
153 | 6 | * Sets codec matcher configuration |
|
154 | * |
||
155 | 6 | * @param array $matcherConfiguration |
|
156 | * @return $this |
||
157 | */ |
||
158 | public function setMatcherConfiguration(array $matcherConfiguration) |
||
164 | |||
165 | /** |
||
166 | * @inheritdoc |
||
167 | */ |
||
168 | public function getUrlPrefix() |
||
172 | 2 | ||
173 | /** |
||
174 | 2 | * Sets URLs prefix |
|
175 | * |
||
176 | 2 | * @param string $urlPrefix |
|
177 | * @return $this |
||
178 | */ |
||
179 | public function setUrlPrefix($urlPrefix) |
||
185 | |||
186 | /** |
||
187 | * @return string[] |
||
188 | */ |
||
189 | public function getSerializationGroups() |
||
193 | 5 | ||
194 | /** |
||
195 | 5 | * @param string[] $serializationGroups |
|
196 | * @return $this |
||
197 | 5 | */ |
|
198 | public function setSerializationGroups(array $serializationGroups) |
||
204 | |||
205 | 1 | /** |
|
206 | * @inheritdoc |
||
207 | */ |
||
208 | public function getValidationGroups() |
||
212 | |||
213 | /** |
||
214 | 3 | * Sets validation groups |
|
215 | * |
||
216 | 3 | * @param array|null $validationGroups |
|
217 | * @return $this |
||
218 | 3 | */ |
|
219 | public function setValidationGroups(array $validationGroups = null) |
||
225 | |||
226 | 1 | /** |
|
227 | * @inheritdoc |
||
228 | */ |
||
229 | public function getEncoder() |
||
233 | |||
234 | /** |
||
235 | 3 | * Sets response encoder |
|
236 | * |
||
237 | 3 | * @param EncoderInterface $encoder |
|
238 | * @return $this |
||
239 | 3 | */ |
|
240 | public function setEncoder(EncoderInterface $encoder) |
||
246 | |||
247 | 3 | /** |
|
248 | * @inheritdoc |
||
249 | 3 | */ |
|
250 | public function getEncoderMediaType() |
||
254 | |||
255 | 1 | /** |
|
256 | * Sets response encoder media type |
||
257 | 1 | * |
|
258 | * @param MediaTypeInterface $encoderMediaType |
||
259 | * @return $this |
||
260 | */ |
||
261 | public function setEncoderMediaType(MediaTypeInterface $encoderMediaType) |
||
267 | |||
268 | 2 | /** |
|
269 | 2 | * @inheritdoc |
|
270 | 2 | */ |
|
271 | 2 | public function setDecoder(DecoderInterface $decoder) |
|
277 | 1 | ||
278 | /** |
||
279 | * @inheritdoc |
||
280 | 2 | */ |
|
281 | 2 | 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 |