1 | <?php |
||
2 | |||
3 | namespace Sludio\HelperBundle\DependencyInjection; |
||
4 | |||
5 | use Sludio\HelperBundle\Guzzle\DataCollector\GuzzleCollector; |
||
6 | use Symfony\Component\Config\Definition\Builder\TreeBuilder; |
||
7 | use Symfony\Component\Config\Definition\ConfigurationInterface; |
||
8 | use Sludio\HelperBundle\Flash\Helper\FlashAlertsHelper; |
||
0 ignored issues
–
show
|
|||
9 | |||
10 | class Configuration implements ConfigurationInterface |
||
11 | { |
||
12 | protected $alias; |
||
13 | |||
14 | /** |
||
15 | * Configuration constructor. |
||
16 | * |
||
17 | * @param $alias |
||
18 | */ |
||
19 | public function __construct($alias) |
||
20 | { |
||
21 | $this->alias = $alias; |
||
22 | } |
||
23 | |||
24 | /** |
||
25 | * {@inheritdoc} |
||
26 | * @throws \RuntimeException |
||
27 | */ |
||
28 | public function getConfigTreeBuilder() |
||
29 | { |
||
30 | $treeBuilder = new TreeBuilder(); |
||
31 | $rootNode = $treeBuilder->root($this->alias); |
||
32 | |||
33 | // @formatter:off |
||
34 | $rootNode |
||
35 | ->children() |
||
36 | ->arrayNode('extensions') |
||
37 | ->addDefaultsIfNotSet() |
||
38 | ->children() |
||
39 | ->arrayNode('captcha') |
||
40 | ->addDefaultsIfNotSet() |
||
41 | ->canBeEnabled() |
||
42 | ->children() |
||
43 | ->arrayNode('clients') |
||
44 | ->prototype('array') |
||
45 | ->prototype('variable')->end() |
||
46 | ->end() |
||
47 | ->end() |
||
48 | ->end() |
||
49 | ->end() |
||
50 | ->arrayNode('guzzle') |
||
51 | ->addDefaultsIfNotSet() |
||
52 | ->canBeEnabled() |
||
53 | ->children() |
||
54 | ->arrayNode('profiler') |
||
55 | ->canBeEnabled() |
||
56 | ->children() |
||
57 | ->integerNode('max_body_size') |
||
58 | ->defaultValue(GuzzleCollector::MAX_BODY_SIZE) |
||
59 | ->end() |
||
60 | ->end() |
||
61 | ->end() |
||
62 | ->arrayNode('logger') |
||
63 | ->canBeEnabled() |
||
64 | ->children() |
||
65 | ->scalarNode('service')->defaultValue(null)->end() |
||
66 | ->scalarNode('format') |
||
67 | ->beforeNormalization() |
||
68 | ->ifInArray(['clf', 'debug', 'short']) |
||
69 | ->then(function($v) { |
||
70 | return \constant('GuzzleHttp\MessageFormatter::'.strtoupper($v)); |
||
71 | }) |
||
72 | ->end() |
||
73 | ->defaultValue('clf') |
||
74 | ->end() |
||
75 | ->scalarNode('level') |
||
76 | ->beforeNormalization() |
||
77 | ->ifInArray([ |
||
78 | 'emergency', 'alert', 'critical', 'error', |
||
79 | 'warning', 'notice', 'info', 'debug', |
||
80 | ]) |
||
81 | ->then(function($v) { |
||
82 | return \constant('Psr\Log\LogLevel::'.strtoupper($v)); |
||
83 | }) |
||
84 | ->end() |
||
85 | ->defaultValue('debug') |
||
86 | ->end() |
||
87 | ->end() |
||
88 | ->end() |
||
89 | ->arrayNode('cache') |
||
90 | ->canBeEnabled() |
||
91 | ->validate() |
||
92 | ->ifTrue(function($v) { |
||
93 | return $v['enabled'] && null === $v['adapter']; |
||
94 | }) |
||
95 | ->thenInvalid('The \''.$this->alias.'.guzzle.cache.adapter\' key is mandatory if you enable the cache middleware') |
||
96 | ->end() |
||
97 | ->children() |
||
98 | ->scalarNode('adapter')->defaultValue(null)->end() |
||
99 | ->booleanNode('disabled')->defaultValue(null)->end() |
||
100 | ->end() |
||
101 | ->end() |
||
102 | ->arrayNode('clients') |
||
103 | ->useAttributeAsKey('name') |
||
104 | ->prototype('array') |
||
105 | ->children() |
||
106 | ->scalarNode('class') |
||
107 | ->defaultValue('GuzzleHttp\Client') |
||
108 | ->end() |
||
109 | ->booleanNode('lazy') |
||
110 | ->defaultValue(false) |
||
111 | ->end() |
||
112 | ->variableNode('config')->end() |
||
113 | ->arrayNode('middleware') |
||
114 | ->prototype('scalar')->end() |
||
115 | ->end() |
||
116 | ->scalarNode('alias') |
||
117 | ->defaultValue(null) |
||
118 | ->end() |
||
119 | ->enumNode('authentication_type') |
||
120 | ->values(['basic']) |
||
121 | ->defaultValue('basic') |
||
122 | ->end() |
||
123 | ->arrayNode('credentials') |
||
124 | ->canBeEnabled() |
||
125 | ->addDefaultsIfNotSet() |
||
126 | ->children() |
||
127 | ->scalarNode('user') |
||
128 | ->defaultValue(null) |
||
129 | ->end() |
||
130 | ->scalarNode('pass') |
||
131 | ->defaultValue(null) |
||
132 | ->end() |
||
133 | ->end() |
||
134 | ->end() |
||
135 | ->end() |
||
136 | ->end() |
||
137 | ->end() |
||
138 | ->arrayNode('mock') |
||
139 | ->canBeEnabled() |
||
140 | ->children() |
||
141 | ->scalarNode('storage_path')->isRequired()->end() |
||
142 | ->scalarNode('mode')->defaultValue('replay')->end() |
||
143 | ->arrayNode('request_headers_blacklist') |
||
144 | ->prototype('scalar')->end() |
||
145 | ->end() |
||
146 | ->arrayNode('response_headers_blacklist') |
||
147 | ->prototype('scalar')->end() |
||
148 | ->end() |
||
149 | ->end() |
||
150 | ->end() |
||
151 | ->end() |
||
152 | ->end() |
||
153 | ->arrayNode('lexik') |
||
154 | ->addDefaultsIfNotSet() |
||
155 | ->canBeEnabled() |
||
156 | ->children() |
||
157 | ->scalarNode('default_domain')->defaultValue('messages')->end() |
||
158 | ->arrayNode('default_selections') |
||
159 | ->addDefaultsIfNotSet() |
||
160 | ->children() |
||
161 | ->booleanNode('non_translated_only')->defaultValue(false)->end() |
||
162 | ->end() |
||
163 | ->end() |
||
164 | ->arrayNode('empty_prefixes') |
||
165 | ->defaultValue(['__', 'new_', '']) |
||
166 | ->prototype('array')->end() |
||
167 | ->end() |
||
168 | ->arrayNode('editable') |
||
169 | ->addDefaultsIfNotSet() |
||
170 | ->children() |
||
171 | ->scalarNode('type')->defaultValue('textarea')->end() |
||
172 | ->scalarNode('emptytext')->defaultValue('Empty')->end() |
||
173 | ->end() |
||
174 | ->end() |
||
175 | ->end() |
||
176 | ->end() |
||
177 | ->arrayNode('mobile') |
||
178 | ->addDefaultsIfNotSet() |
||
179 | ->canBeEnabled() |
||
180 | ->end() |
||
181 | ->arrayNode('oauth') |
||
182 | ->addDefaultsIfNotSet() |
||
183 | ->canBeEnabled() |
||
184 | ->children() |
||
185 | ->arrayNode('clients') |
||
186 | ->prototype('array') |
||
187 | ->prototype('variable')->end() |
||
188 | ->end() |
||
189 | ->end() |
||
190 | ->arrayNode('custom_providers') |
||
191 | ->prototype('array') |
||
192 | ->prototype('variable')->end() |
||
193 | ->end() |
||
194 | ->end() |
||
195 | ->end() |
||
196 | ->end() |
||
197 | ->arrayNode('openid') |
||
198 | ->addDefaultsIfNotSet() |
||
199 | ->canBeEnabled() |
||
200 | ->children() |
||
201 | ->arrayNode('clients') |
||
202 | ->prototype('array') |
||
203 | ->prototype('variable')->end() |
||
204 | ->end() |
||
205 | ->end() |
||
206 | ->end() |
||
207 | ->end() |
||
208 | ->arrayNode('openidconnect') |
||
209 | ->addDefaultsIfNotSet() |
||
210 | ->canBeEnabled() |
||
211 | ->children() |
||
212 | ->arrayNode('clients') |
||
213 | ->prototype('array') |
||
214 | ->prototype('variable')->end() |
||
215 | ->end() |
||
216 | ->end() |
||
217 | ->end() |
||
218 | ->end() |
||
219 | ->arrayNode('pagination') |
||
220 | ->addDefaultsIfNotSet() |
||
221 | ->canBeEnabled() |
||
222 | ->children() |
||
223 | ->arrayNode('behaviour') |
||
224 | ->prototype('array') |
||
225 | ->prototype('variable')->end() |
||
226 | ->end() |
||
227 | ->end() |
||
228 | ->end() |
||
229 | ->end() |
||
230 | ->arrayNode('position') |
||
231 | ->addDefaultsIfNotSet() |
||
232 | ->canBeEnabled() |
||
233 | ->children() |
||
234 | ->arrayNode('field') |
||
235 | ->addDefaultsIfNotSet() |
||
236 | ->children() |
||
237 | ->scalarNode('default') |
||
238 | ->defaultValue('position') |
||
239 | ->end() |
||
240 | ->arrayNode('entities') |
||
241 | ->prototype('scalar')->end() |
||
242 | ->end() |
||
243 | ->end() |
||
244 | ->end() |
||
245 | ->end() |
||
246 | ->end() |
||
247 | ->arrayNode('script') |
||
248 | ->addDefaultsIfNotSet() |
||
249 | ->canBeEnabled() |
||
250 | ->children() |
||
251 | ->booleanNode('short_functions') |
||
252 | ->defaultValue(false) |
||
253 | ->end() |
||
254 | ->end() |
||
255 | ->end() |
||
256 | ->arrayNode('sitemap') |
||
257 | ->addDefaultsIfNotSet() |
||
258 | ->canBeEnabled() |
||
259 | ->children() |
||
260 | ->scalarNode('base_host') |
||
261 | ->defaultValue(null) |
||
262 | ->end() |
||
263 | ->scalarNode('limit') |
||
264 | ->defaultValue(null) |
||
265 | ->end() |
||
266 | ->enumNode('format') |
||
267 | ->values(['simple', 'rich']) |
||
268 | ->defaultValue('simple') |
||
269 | ->end() |
||
270 | ->enumNode('type') |
||
271 | ->values(['simple', 'gz']) |
||
272 | ->defaultValue('simple') |
||
273 | ->end() |
||
274 | ->end() |
||
275 | ->end() |
||
276 | ->arrayNode('translatable') |
||
277 | ->addDefaultsIfNotSet() |
||
278 | ->canBeEnabled() |
||
279 | ->children() |
||
280 | ->arrayNode('locales') |
||
281 | ->beforeNormalization() |
||
282 | ->ifString() |
||
283 | ->then(function($v) { |
||
284 | return preg_split('/\s*,\s*/', $v); |
||
285 | }) |
||
286 | ->end() |
||
287 | ->prototype('scalar')->end() |
||
288 | ->end() |
||
289 | ->scalarNode('default_locale') |
||
290 | ->defaultValue('en') |
||
291 | ->end() |
||
292 | ->scalarNode('template') |
||
293 | ->defaultValue('SludioHelperBundle:Translatable:translations.html.twig') |
||
294 | ->end() |
||
295 | ->scalarNode('table') |
||
296 | ->defaultValue('sludio_helper_translation') |
||
297 | ->end() |
||
298 | ->scalarNode('manager') |
||
299 | ->defaultValue('default') |
||
300 | ->end() |
||
301 | ->arrayNode('entities') |
||
302 | ->useAttributeAsKey('name') |
||
303 | ->prototype('array') |
||
304 | ->children() |
||
305 | ->scalarNode('entity') |
||
306 | ->defaultValue(null) |
||
307 | ->end() |
||
308 | ->arrayNode('fields') |
||
309 | ->useAttributeAsKey('name') |
||
310 | ->prototype('array') |
||
311 | ->children() |
||
312 | ->enumNode('class') |
||
313 | ->values(['titled', 'slugged', 'ck_item', null]) |
||
314 | ->defaultValue(null) |
||
315 | ->end() |
||
316 | ->enumNode('type') |
||
317 | ->values(['text', 'ckeditor']) |
||
318 | ->defaultValue('text') |
||
319 | ->end() |
||
320 | ->end() |
||
321 | ->end() |
||
322 | ->end() |
||
323 | ->end() |
||
324 | ->end() |
||
325 | ->end() |
||
326 | ->end() |
||
327 | ->end() |
||
328 | ->end() |
||
329 | ->end() |
||
330 | ->arrayNode('other') |
||
331 | ->addDefaultsIfNotSet() |
||
332 | ->children() |
||
333 | ->arrayNode('redis') |
||
334 | ->addDefaultsIfNotSet() |
||
335 | ->children() |
||
336 | ->scalarNode('translation') |
||
337 | ->defaultValue('session') |
||
338 | ->end() |
||
339 | ->scalarNode('guzzle') |
||
340 | ->defaultValue('session') |
||
341 | ->end() |
||
342 | ->end() |
||
343 | ->end() |
||
344 | ->arrayNode('entity') |
||
345 | ->addDefaultsIfNotSet() |
||
346 | ->children() |
||
347 | ->scalarNode('manager') |
||
348 | ->defaultValue('default') |
||
349 | ->end() |
||
350 | ->end() |
||
351 | ->end() |
||
352 | ->scalarNode('locale') |
||
353 | ->defaultValue('en') |
||
354 | ->end() |
||
355 | ->end() |
||
356 | ->end() |
||
357 | ->end() |
||
358 | ; |
||
359 | // @formatter:on |
||
360 | |||
361 | return $treeBuilder; |
||
362 | } |
||
363 | } |
||
364 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths