vendor/laupifrpar/pusher-bundle/DependencyInjection/Configuration.php line 29

Open in your IDE?
  1. <?php
  2. /*
  3.  * For the full copyright and license information, please view the LICENSE
  4.  * file that was distributed with this source code.
  5.  */
  6. namespace Lopi\Bundle\PusherBundle\DependencyInjection;
  7. use Symfony\Component\Config\Definition\Builder\TreeBuilder;
  8. use Symfony\Component\Config\Definition\ConfigurationInterface;
  9. /**
  10.  * PusherBundle configuration structure.
  11.  *
  12.  * @author Pierre-Louis LAUNAY <laupi.frpar@gmail.com>
  13.  */
  14. class Configuration implements ConfigurationInterface
  15. {
  16.     /**
  17.      * Generates the configuration tree builder.
  18.      *
  19.      * @return \Symfony\Component\Config\Definition\Builder\TreeBuilder The tree builder
  20.      */
  21.     public function getConfigTreeBuilder()
  22.     {
  23.         $treeBuilder = new TreeBuilder();
  24.         $rootNode $treeBuilder->root('lopi_pusher''array');
  25.         $rootNode
  26.             ->validate()
  27.                 ->ifTrue(
  28.                     function ($data) {
  29.                         return empty($data['url'])
  30.                             && (
  31.                                 empty($data['app_id'])
  32.                                 || empty($data['key'])
  33.                                 || empty($data['secret'])
  34.                             );
  35.                     }
  36.                 )
  37.                 ->thenInvalid('Either url or app_id, key and secret needs to be set.')
  38.             ->end()
  39.             ->children()
  40.                 ->scalarNode('url')->end()
  41.                 ->scalarNode('app_id')->end()
  42.                 ->scalarNode('key')->end()
  43.                 ->scalarNode('secret')->end()
  44.                 ->scalarNode('cluster')->defaultValue('us-east-1')->end()
  45.                 ->booleanNode('debug')->defaultValue(false)->end()
  46.                 ->scalarNode('scheme')->defaultValue('http')->end()
  47.                 ->scalarNode('host')->defaultValue('api.pusherapp.com')->end()
  48.                 ->scalarNode('port')->defaultValue('80')->end()
  49.                 ->scalarNode('timeout')->defaultValue('30')->end()
  50.                 ->scalarNode('auth_service_id')->defaultNull()->end()
  51.             ->end();
  52.         return $treeBuilder;
  53.     }
  54. }