vendor/rollbar/rollbar-php-symfony-bundle/DependencyInjection/Configuration.php line 25

Open in your IDE?
  1. <?php
  2. namespace Rollbar\Symfony\RollbarBundle\DependencyInjection;
  3. use Rollbar\Config;
  4. use Rollbar\Defaults;
  5. use Symfony\Component\Config\Definition\Builder\TreeBuilder;
  6. use Symfony\Component\Config\Definition\ConfigurationInterface;
  7. /**
  8.  * Class Configuration
  9.  *
  10.  * @link https://rollbar.com/docs/notifier/rollbar-php/#configuration-reference
  11.  *
  12.  * @package Rollbar\Symfony\RollbarBundle\DependencyInjection
  13.  */
  14. class Configuration implements ConfigurationInterface
  15. {
  16.     /**
  17.      * {@inheritdoc}
  18.      */
  19.     public function getConfigTreeBuilder()
  20.     {
  21.         $treeBuilder = new TreeBuilder();
  22.         $rollbarConfigNode $treeBuilder->root(RollbarExtension::ALIAS);
  23.         $rollbarConfigNodeChildren $rollbarConfigNode->children();
  24.         $configOptions Config::listOptions();
  25.         $rollbarDefaults Defaults::get();
  26.         foreach ($configOptions as $option) {
  27.             switch ($option) {
  28.                 case 'branch':
  29.                     $method 'gitBranch';
  30.                     break;
  31.                 default:
  32.                     $method $option;
  33.                     break;
  34.             }
  35.             try {
  36.                 $default $rollbarDefaults->fromSnakeCase($method);
  37.             } catch (\Exception $e) {
  38.                 $default null;
  39.             }
  40.             if (is_array($default)) {
  41.                 $rollbarConfigNodeChildren
  42.                     ->arrayNode($option)
  43.                         ->scalarPrototype()->end()
  44.                         ->defaultValue($default)
  45.                     ->end();
  46.             } else {
  47.                 $rollbarConfigNodeChildren
  48.                     ->scalarNode($option)
  49.                         ->defaultValue($default)
  50.                     ->end();
  51.             }
  52.         }
  53.         return $treeBuilder;
  54.     }
  55. }