/DependencyInjection/Configuration.php

http://github.com/FriendsOfSymfony/FOSFacebookBundle · PHP · 66 lines · 39 code · 6 blank · 21 comment · 0 complexity · dbe462e10ccff88067359331a8a9daa8 MD5 · raw file

  1. <?php
  2. /*
  3. * This file is part of the FOSFacebookBundle package.
  4. *
  5. * (c) FriendsOfSymfony <http://friendsofsymfony.github.com/>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace FOS\FacebookBundle\DependencyInjection;
  11. use Symfony\Component\Config\Definition\Builder\TreeBuilder,
  12. Symfony\Component\Config\Definition\ConfigurationInterface;
  13. /**
  14. * This class contains the configuration information for the bundle
  15. *
  16. * This information is solely responsible for how the different configuration
  17. * sections are normalized, and merged.
  18. *
  19. * @author Lukas Kahwe Smith <smith@pooteeweet.org>
  20. */
  21. class Configuration implements ConfigurationInterface
  22. {
  23. /**
  24. * Generates the configuration tree.
  25. *
  26. * @return TreeBuilder
  27. */
  28. public function getConfigTreeBuilder()
  29. {
  30. $treeBuilder = new TreeBuilder();
  31. $rootNode = $treeBuilder->root('fos_facebook');
  32. $rootNode
  33. ->fixXmlConfig('permission', 'permissions')
  34. ->children()
  35. ->scalarNode('app_id')->isRequired()->cannotBeEmpty()->end()
  36. ->scalarNode('secret')->isRequired()->cannotBeEmpty()->end()
  37. ->scalarNode('cookie')->defaultFalse()->end()
  38. ->scalarNode('domain')->defaultNull()->end()
  39. ->scalarNode('alias')->defaultNull()->end()
  40. ->scalarNode('logging')->defaultValue('%kernel.debug%')->end()
  41. ->scalarNode('culture')->defaultValue('en_US')->end()
  42. ->arrayNode('class')
  43. ->addDefaultsIfNotSet()
  44. ->children()
  45. ->scalarNode('api')->defaultValue('FOS\FacebookBundle\Facebook\FacebookSessionPersistence')->end()
  46. ->scalarNode('helper')->defaultValue('FOS\FacebookBundle\Templating\Helper\FacebookHelper')->end()
  47. ->scalarNode('twig')->defaultValue('FOS\FacebookBundle\Twig\Extension\FacebookExtension')->end()
  48. ->end()
  49. ->end()
  50. ->arrayNode('channel')
  51. ->addDefaultsIfNotSet()
  52. ->children()
  53. ->scalarNode('expire')->defaultValue(60*60*24*365)->end()
  54. ->end()
  55. ->end()
  56. ->arrayNode('permissions')->prototype('scalar')->end()
  57. ->end();
  58. return $treeBuilder;
  59. }
  60. }