This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | /* |
||
4 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||
5 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
||
6 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
||
7 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
||
8 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
||
9 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
||
10 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
||
11 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
||
12 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||
13 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
||
14 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||
15 | * |
||
16 | * The software is based on the Axon Framework project which is |
||
17 | * licensed under the Apache 2.0 license. For more information on the Axon Framework |
||
18 | * see <http://www.axonframework.org/>. |
||
19 | * |
||
20 | * This software consists of voluntary contributions made by many individuals |
||
21 | * and is licensed under the MIT license. For more information, see |
||
22 | * <http://www.governor-framework.org/>. |
||
23 | */ |
||
24 | |||
25 | namespace Governor\Bundle\GovernorBundle\DependencyInjection; |
||
26 | |||
27 | use Symfony\Component\Config\Definition\Builder\TreeBuilder; |
||
28 | use Symfony\Component\Config\Definition\ConfigurationInterface; |
||
29 | |||
30 | /** |
||
31 | * Describes the configuration of the Governor Framework. |
||
32 | * |
||
33 | * @author "David Kalosi" <[email protected]> |
||
34 | * @license <a href="http://www.opensource.org/licenses/mit-license.php">MIT License</a> |
||
35 | */ |
||
36 | class Configuration implements ConfigurationInterface |
||
37 | { |
||
38 | 11 | public function getConfigTreeBuilder() |
|
39 | { |
||
40 | 11 | $treeBuilder = new TreeBuilder(); |
|
41 | 11 | $rootNode = $treeBuilder->root('governor'); |
|
42 | |||
43 | $rootNode |
||
44 | 11 | ->children() |
|
45 | 11 | ->scalarNode('node_name')->isRequired()->end() |
|
46 | 11 | ->scalarNode('uow_factory')->defaultValue('governor.uow_factory.default')->end() |
|
47 | 11 | ->scalarNode('command_target_resolver') |
|
48 | 11 | ->defaultValue('annotation') |
|
49 | 11 | ->validate() |
|
50 | 11 | ->ifNotInArray(['annotation', 'metadata']) |
|
51 | 11 | ->thenInvalid('Invalid command target resolver "%s", possible values are '. |
|
52 | 11 | "[\"annotation\",\"metadata\"]") |
|
53 | 11 | ->end() |
|
54 | 11 | ->end() |
|
55 | 11 | ->scalarNode('order_resolver') |
|
56 | 11 | ->defaultValue('annotation') |
|
57 | 11 | ->end() |
|
58 | 11 | ->scalarNode('lock_manager') |
|
59 | 11 | ->defaultValue('null') |
|
60 | 11 | ->validate() |
|
61 | 11 | ->ifNotInArray(['null', 'optimistic', 'pesimistic']) |
|
62 | 11 | ->thenInvalid('Invalid lock manager "%s", possible values are '. |
|
63 | 11 | "[\"null\",\"optimistic\",\"pesimistic\"]") |
|
64 | 11 | ->end() |
|
65 | 11 | ->end() |
|
66 | 11 | ->arrayNode('annotation_reader') |
|
67 | 11 | ->children() |
|
68 | 11 | ->scalarNode('type') |
|
69 | 11 | ->defaultValue('simple') |
|
70 | 11 | ->validate() |
|
71 | 11 | ->ifNotInArray(['simple', 'file_cache']) |
|
72 | 11 | ->thenInvalid('Invalid annotation reader "%s", possible values are '. |
|
73 | 11 | "[\"simple\",\"file_cache\"]") |
|
74 | 11 | ->end() |
|
75 | 11 | ->end() |
|
76 | 11 | ->arrayNode('parameters') |
|
77 | 11 | ->children() |
|
78 | 11 | ->scalarNode('path')->end() |
|
79 | 11 | ->booleanNode('debug')->end() |
|
80 | 11 | ->end() |
|
81 | 11 | ->end() |
|
82 | 11 | ->end() |
|
83 | 11 | ->end() |
|
84 | 11 | ->arrayNode('event_store') |
|
85 | 11 | ->append($this->addMongoTemplates()) |
|
86 | 11 | ->children() |
|
87 | 11 | ->scalarNode('type') |
|
88 | 11 | ->validate() |
|
89 | 11 | ->ifNotInArray(['orm', 'mongo', 'filesystem']) |
|
90 | 11 | ->thenInvalid('Invalid event store "%s", possible values are '. |
|
91 | 11 | "[\"orm\",\"mongo\", \"filesystem\"]") |
|
92 | 11 | ->end() |
|
93 | 11 | ->end() |
|
94 | 11 | ->arrayNode('parameters') |
|
95 | 11 | ->children() |
|
96 | 11 | ->scalarNode('entity_manager')->end() |
|
97 | 11 | ->scalarNode('entry_store')->end() |
|
98 | 11 | ->scalarNode('mongo_template')->defaultValue('governor.event_store.mongo_template.default')->end() |
|
99 | 11 | ->scalarNode('storage_strategy')->defaultValue('governor.storage_strategy.event')->end() |
|
100 | 11 | ->scalarNode('directory')->end() |
|
101 | 11 | ->end() |
|
102 | 11 | ->end() |
|
103 | 11 | ->end() |
|
104 | 11 | ->end() |
|
105 | 11 | ->arrayNode('saga_repository') |
|
106 | 11 | ->append($this->addMongoTemplates()) |
|
107 | 11 | ->children() |
|
108 | 11 | ->scalarNode('type') |
|
109 | 11 | ->defaultValue('orm') |
|
110 | 11 | ->validate() |
|
111 | 11 | ->ifNotInArray(['orm', 'mongo']) |
|
112 | 11 | ->thenInvalid('Invalid saga repository "%s", possible values are '. |
|
113 | 11 | "[\"orm\",\"mongo\"]") |
|
114 | 11 | ->end() |
|
115 | 11 | ->end() |
|
116 | 11 | ->arrayNode('parameters') |
|
117 | 11 | ->children() |
|
118 | 11 | ->scalarNode('entity_manager')->end() |
|
119 | 11 | ->scalarNode('mongo_template')->defaultValue('governor.saga_repository.mongo_template.default')->end() |
|
120 | 11 | ->end() |
|
121 | 11 | ->end() |
|
122 | 11 | ->end() |
|
123 | 11 | ->end() |
|
124 | 11 | ->scalarNode('serializer') |
|
125 | 11 | ->defaultValue('jms') |
|
126 | 11 | ->validate() |
|
127 | 11 | ->ifNotInArray(['jms']) |
|
128 | 11 | ->thenInvalid('Invalid serializer "%s", possible values are '. |
|
129 | 11 | "[\"jms\"]") |
|
130 | 11 | ->end() |
|
131 | 11 | ->end() |
|
132 | 11 | ->arrayNode('saga_manager') |
|
133 | 11 | ->children() |
|
134 | 11 | ->scalarNode('type')->defaultValue('annotation')->end() |
|
135 | 11 | ->scalarNode('event_bus')->defaultValue('default')->end() |
|
136 | 11 | ->arrayNode('saga_locations') |
|
137 | 11 | ->prototype('scalar')->end() |
|
138 | 11 | ->end() |
|
139 | 11 | ->end() |
|
140 | 11 | ->end() |
|
141 | 11 | ->append($this->addAggregatesNode()) |
|
142 | 11 | ->append($this->addRoutingStrategies()) |
|
143 | 11 | ->append($this->addCommandBusesNode()) |
|
144 | 11 | ->append($this->addEventBusesNode()) |
|
145 | 11 | ->append($this->addCommandGatewaysNode()) |
|
146 | 11 | ->append($this->addTerminalsNode()) |
|
147 | 11 | ->append($this->addConnectorsNode()) |
|
148 | 11 | ->end(); |
|
149 | |||
150 | 11 | return $treeBuilder; |
|
151 | } |
||
152 | |||
153 | 11 | private function addRoutingStrategies() |
|
154 | { |
||
155 | 11 | $treeBuilder = new TreeBuilder(); |
|
156 | 11 | $node = $treeBuilder->root('routing_strategies'); |
|
157 | |||
158 | 11 | $node->useAttributeAsKey('name') |
|
159 | 11 | ->prototype('array') |
|
160 | 11 | ->children() |
|
161 | 11 | ->scalarNode('type')->isRequired()->end() |
|
162 | 11 | ->arrayNode('parameters') |
|
163 | 11 | ->children() |
|
164 | 11 | ->scalarNode('key_name')->end() |
|
165 | 11 | ->end() |
|
166 | 11 | ->end() |
|
167 | 11 | ->end() |
|
168 | 11 | ->end(); |
|
169 | |||
170 | 11 | return $node; |
|
171 | } |
||
172 | |||
173 | 11 | View Code Duplication | private function addCommandBusesNode() |
0 ignored issues
–
show
|
|||
174 | { |
||
175 | 11 | $treeBuilder = new TreeBuilder(); |
|
176 | 11 | $node = $treeBuilder->root('command_buses'); |
|
177 | |||
178 | 11 | $node->useAttributeAsKey('name') |
|
179 | 11 | ->prototype('array') |
|
180 | 11 | ->children() |
|
181 | 11 | ->scalarNode('type')->isRequired()->end() |
|
182 | 11 | ->scalarNode('connector')->end() |
|
183 | 11 | ->scalarNode('routing_strategy')->end() |
|
184 | 11 | ->arrayNode('handler_interceptors') |
|
185 | 11 | ->prototype('scalar')->end() |
|
186 | 11 | ->end() |
|
187 | 11 | ->arrayNode('dispatch_interceptors') |
|
188 | 11 | ->prototype('scalar')->end() |
|
189 | 11 | ->end() |
|
190 | 11 | ->end() |
|
191 | 11 | ->end(); |
|
192 | |||
193 | 11 | return $node; |
|
194 | } |
||
195 | |||
196 | 11 | private function addEventBusesNode() |
|
197 | { |
||
198 | 11 | $treeBuilder = new TreeBuilder(); |
|
199 | 11 | $node = $treeBuilder->root('event_buses'); |
|
200 | |||
201 | $node |
||
202 | 11 | ->useAttributeAsKey('name') |
|
203 | 11 | ->prototype('array') |
|
204 | 11 | ->children() |
|
205 | 11 | ->scalarNode('class')->isRequired()->end() |
|
206 | 11 | ->scalarNode('registry')->isRequired()->end() |
|
207 | 11 | ->arrayNode('terminals') |
|
208 | 11 | ->prototype('scalar')->end() |
|
209 | 11 | ->end() |
|
210 | 11 | ->end() |
|
211 | 11 | ->end(); |
|
212 | |||
213 | 11 | return $node; |
|
214 | } |
||
215 | |||
216 | 11 | private function addMongoTemplates() |
|
217 | { |
||
218 | 11 | $treeBuilder = new TreeBuilder(); |
|
219 | 11 | $node = $treeBuilder->root('mongo_templates'); |
|
220 | |||
221 | $node |
||
222 | 11 | ->useAttributeAsKey('name') |
|
223 | 11 | ->prototype('array') |
|
224 | 11 | ->children() |
|
225 | 11 | ->scalarNode('server')->isRequired()->end() |
|
226 | 11 | ->scalarNode('database')->isRequired()->end() |
|
227 | 11 | ->scalarNode('auth_database')->defaultValue(null)->end() |
|
228 | 11 | ->scalarNode('event_collection')->defaultValue(null)->end() |
|
229 | 11 | ->scalarNode('snapshot_collection')->defaultValue(null)->end() |
|
230 | 11 | ->end() |
|
231 | 11 | ->end(); |
|
232 | |||
233 | 11 | return $node; |
|
234 | } |
||
235 | |||
236 | 11 | private function addCommandGatewaysNode() |
|
237 | { |
||
238 | 11 | $treeBuilder = new TreeBuilder(); |
|
239 | 11 | $node = $treeBuilder->root('command_gateways'); |
|
240 | |||
241 | $node |
||
242 | 11 | ->useAttributeAsKey('name') |
|
243 | 11 | ->prototype('array') |
|
244 | 11 | ->children() |
|
245 | 11 | ->scalarNode('class')->isRequired()->end() |
|
246 | 11 | ->scalarNode('command_bus')->defaultValue('default')->end() |
|
247 | 11 | ->end() |
|
248 | 11 | ->end(); |
|
249 | |||
250 | 11 | return $node; |
|
251 | } |
||
252 | |||
253 | 11 | private function addTerminalsNode() |
|
254 | { |
||
255 | 11 | $treeBuilder = new TreeBuilder(); |
|
256 | 11 | $node = $treeBuilder->root('terminals'); |
|
257 | |||
258 | $node |
||
259 | 11 | ->children() |
|
260 | 11 | ->arrayNode('amqp') |
|
261 | 11 | ->canBeUnset() |
|
262 | 11 | ->useAttributeAsKey('name') |
|
263 | 11 | ->prototype('array') |
|
264 | 11 | ->cannotBeEmpty() |
|
265 | 11 | ->children() |
|
266 | 11 | ->scalarNode('host')->defaultValue('localhost')->end() |
|
267 | 11 | ->scalarNode('port')->defaultValue(5672)->end() |
|
268 | 11 | ->scalarNode('user')->defaultValue('guest')->end() |
|
269 | 11 | ->scalarNode('password')->defaultValue('guest')->end() |
|
270 | 11 | ->scalarNode('vhost')->defaultValue('/')->end() |
|
271 | 11 | ->scalarNode('routing_key_resolver')->end() |
|
272 | 11 | ->end() |
|
273 | 11 | ->end() |
|
274 | 11 | ->end() |
|
275 | 11 | ->end() |
|
276 | 11 | ->end(); |
|
277 | |||
278 | 11 | return $node; |
|
279 | } |
||
280 | |||
281 | 11 | View Code Duplication | private function addConnectorsNode() |
0 ignored issues
–
show
This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
282 | { |
||
283 | 11 | $treeBuilder = new TreeBuilder(); |
|
284 | 11 | $node = $treeBuilder->root('connectors'); |
|
285 | |||
286 | $node |
||
287 | 11 | ->children() |
|
288 | 11 | ->arrayNode('redis') |
|
289 | 11 | ->canBeUnset() |
|
290 | 11 | ->useAttributeAsKey('name') |
|
291 | 11 | ->prototype('array') |
|
292 | 11 | ->cannotBeEmpty() |
|
293 | 11 | ->children() |
|
294 | 11 | ->scalarNode('url')->defaultValue('tcp://127.0.0.1:6379')->end() |
|
295 | 11 | ->scalarNode('routing_strategy')->end() |
|
296 | 11 | ->scalarNode('local_segment')->end() |
|
297 | 11 | ->end() |
|
298 | 11 | ->end() |
|
299 | 11 | ->end() |
|
300 | 11 | ->end() |
|
301 | 11 | ->end(); |
|
302 | |||
303 | 11 | return $node; |
|
304 | } |
||
305 | |||
306 | 11 | private function addAggregatesNode() |
|
307 | { |
||
308 | 11 | $treeBuilder = new TreeBuilder(); |
|
309 | 11 | $node = $treeBuilder->root('aggregates'); |
|
310 | |||
311 | $node |
||
312 | 11 | ->useAttributeAsKey('name') |
|
313 | 11 | ->prototype('array') |
|
314 | 11 | ->children() |
|
315 | 11 | ->scalarNode('class')->isRequired()->end() |
|
316 | 11 | ->booleanNode('handler')->defaultValue(false)->end() |
|
317 | 11 | ->scalarNode('event_bus')->defaultValue('default')->end() |
|
318 | 11 | ->scalarNode('command_bus')->defaultValue('default')->end() |
|
319 | 11 | ->scalarNode('factory')->end() |
|
320 | 11 | ->scalarNode('repository') |
|
321 | 11 | ->isRequired() |
|
322 | 11 | ->cannotBeEmpty() |
|
323 | 11 | ->validate() |
|
324 | 11 | ->ifNotInArray(['orm', 'event_sourcing', 'hybrid']) |
|
325 | 11 | ->thenInvalid("Invalid repository type %s, possible values are " . |
|
326 | 11 | "[\"orm\",\"event_sourcing\",\"hybrid\"]") |
|
327 | 11 | ->end() |
|
328 | 11 | ->end() |
|
329 | 11 | ->end() |
|
330 | 11 | ->end() |
|
331 | 11 | ->end(); |
|
332 | |||
333 | 11 | return $node; |
|
334 | } |
||
335 | |||
336 | } |
||
337 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.