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 | * Validation groups |
||
57 | * |
||
58 | * @var string[]|null |
||
59 | */ |
||
60 | protected $validationGroups; |
||
61 | |||
62 | /** |
||
63 | * Request decoder |
||
64 | * |
||
65 | * @var DecoderInterface|null |
||
66 | */ |
||
67 | protected $decoder; |
||
68 | |||
69 | /** |
||
70 | * Response encoder |
||
71 | * |
||
72 | * @var EncoderInterface|null |
||
73 | */ |
||
74 | protected $encoder; |
||
75 | |||
76 | /** |
||
77 | * Response encoder media type |
||
78 | * |
||
79 | * @var MediaTypeInterface|null |
||
80 | */ |
||
81 | protected $encoderMediaType; |
||
82 | |||
83 | /** |
||
84 | * Constructor |
||
85 | * |
||
86 | * @param array|null $config |
||
87 | */ |
||
88 | 2 | public function __construct(array $config = null) |
|
94 | |||
95 | /** |
||
96 | * @inheritdoc |
||
97 | */ |
||
98 | 1 | public function getQueryType() |
|
102 | |||
103 | /** |
||
104 | * Sets expected query parameters type |
||
105 | * |
||
106 | * @param null|string $queryType |
||
107 | * @return $this |
||
108 | */ |
||
109 | 1 | public function setQueryType($queryType = null) |
|
115 | |||
116 | /** |
||
117 | * @inheritdoc |
||
118 | */ |
||
119 | 1 | public function getBodyType() |
|
123 | |||
124 | /** |
||
125 | * Sets expected body content type |
||
126 | * |
||
127 | * @param null|string $bodyType |
||
128 | * @return $this |
||
129 | */ |
||
130 | 1 | public function setBodyType($bodyType = null) |
|
136 | |||
137 | /** |
||
138 | * @inheritdoc |
||
139 | */ |
||
140 | 1 | public function getMatcherConfiguration() |
|
144 | |||
145 | /** |
||
146 | * Sets codec matcher configuration |
||
147 | * |
||
148 | * @param array $matcherConfiguration |
||
149 | * @return $this |
||
150 | */ |
||
151 | 2 | public function setMatcherConfiguration(array $matcherConfiguration) |
|
157 | |||
158 | /** |
||
159 | * @inheritdoc |
||
160 | */ |
||
161 | 1 | public function getUrlPrefix() |
|
165 | |||
166 | /** |
||
167 | * Sets URLs prefix |
||
168 | * |
||
169 | * @param string $urlPrefix |
||
170 | * @return $this |
||
171 | */ |
||
172 | 1 | public function setUrlPrefix($urlPrefix) |
|
178 | |||
179 | /** |
||
180 | * @inheritdoc |
||
181 | */ |
||
182 | 1 | public function getValidationGroups() |
|
186 | |||
187 | /** |
||
188 | * Sets validation groups |
||
189 | * |
||
190 | * @param array|null $validationGroups |
||
191 | * @return $this |
||
192 | */ |
||
193 | 2 | public function setValidationGroups(array $validationGroups = null) |
|
199 | |||
200 | /** |
||
201 | * @inheritdoc |
||
202 | */ |
||
203 | public function getEncoder() |
||
207 | |||
208 | /** |
||
209 | * Sets response encoder |
||
210 | * |
||
211 | * @param EncoderInterface $encoder |
||
212 | * @return $this |
||
213 | */ |
||
214 | public function setEncoder(EncoderInterface $encoder) |
||
220 | |||
221 | /** |
||
222 | * @inheritdoc |
||
223 | */ |
||
224 | public function getEncoderMediaType() |
||
228 | |||
229 | /** |
||
230 | * Sets response encoder media type |
||
231 | * |
||
232 | * @param MediaTypeInterface $encoderMediaType |
||
233 | * @return $this |
||
234 | */ |
||
235 | public function setEncoderMediaType(MediaTypeInterface $encoderMediaType) |
||
241 | |||
242 | /** |
||
243 | * @inheritdoc |
||
244 | */ |
||
245 | public function setDecoder(DecoderInterface $decoder) |
||
251 | |||
252 | /** |
||
253 | * @inheritdoc |
||
254 | */ |
||
255 | public function getDecoder() |
||
259 | |||
260 | /** |
||
261 | * Sets environment configuration from array |
||
262 | * |
||
263 | * @param array $config |
||
264 | */ |
||
265 | 2 | protected function fromArray(array $config) |
|
283 | } |
||
284 |