@@ -24,6 +24,8 @@ class Configuration implements ConfigurationInterface
2424 const ENVIRONMENT = 'production ' ;
2525 const TIMEOUT = 3 ;
2626
27+ const API_ENDPOINT = 'https://api.rollbar.com/api/1/ ' ;
28+
2729 const JS_ITEMS_PER_MINUTE = 60 ;
2830 const JS_MAX_ITEMS = 0 ;
2931 const JS_UNCAUGHT_LEVEL = "error " ;
@@ -80,8 +82,8 @@ public function getConfigTreeBuilder()
8082 ->defaultValue ('%kernel.logs_dir%/rollbar.log ' )
8183 ->end ()
8284 ->booleanNode ('allow_exec ' )->defaultTrue ()->end ()
83- ->scalarNode ('endpoint ' )->defaultValue (' https://api.rollbar.com/api/1/ ' )->end ()
84- ->scalarNode ('base_api_url ' )->defaultValue (' https://api.rollbar.com/api/1/ ' )->end ()
85+ ->scalarNode ('endpoint ' )->defaultValue (static :: API_ENDPOINT )->end ()
86+ ->scalarNode ('base_api_url ' )->defaultValue (static :: API_ENDPOINT )->end ()
8587 ->scalarNode ('branch ' )->defaultValue (static ::BRANCH )->end ()
8688 ->booleanNode ('capture_error_stacktraces ' )->defaultTrue ()->end ()
8789 ->scalarNode ('checkIgnore ' )->defaultNull ()->end ()
@@ -100,7 +102,26 @@ public function getConfigTreeBuilder()
100102 ->end ()
101103 ->arrayNode ('exception_sample_rates ' )
102104 ->treatNullLike ([])
103- ->prototype ('scalar ' )->end ()
105+ ->beforeNormalization ()
106+ ->always (function ($ values ) {
107+ $ result = [];
108+
109+ foreach ($ values as $ value ) {
110+ foreach ($ value as $ class => $ rate ) {
111+ $ result [] = ['class ' => $ class , 'rate ' => $ rate ];
112+ }
113+ }
114+
115+ return $ result ;
116+ })
117+ ->end ()
118+ ->useAttributeAsKey ('class ' )
119+ ->arrayPrototype ()
120+ ->children ()
121+ ->scalarNode ('class ' )->end ()
122+ ->floatNode ('rate ' )->end ()
123+ ->end ()
124+ ->end ()
104125 ->defaultValue ([])
105126 ->end ()
106127 ->scalarNode ('fluent_host ' )->defaultValue (static ::FLUENT_HOST )->end ()
0 commit comments