vendor/suncat/mobile-detect-bundle/SunCat/MobileDetectBundle/DependencyInjection/Configuration.php line 32

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of the MobileDetectBundle.
  4.  *
  5.  * (c) Nikolay Ivlev <nikolay.kotovsky@gmail.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 SunCat\MobileDetectBundle\DependencyInjection;
  11. use SunCat\MobileDetectBundle\Helper\DeviceView;
  12. use Symfony\Component\Config\Definition\Builder\TreeBuilder;
  13. use Symfony\Component\Config\Definition\ConfigurationInterface;
  14. use SunCat\MobileDetectBundle\EventListener\RequestResponseListener;
  15. /**
  16.  * Bundle configuration
  17.  *
  18.  * @author suncat2000 <nikolay.kotovsky@gmail.com>
  19.  * @author HenriVesala <email@gmail.com>
  20.  */
  21. class Configuration implements ConfigurationInterface
  22. {
  23.     /**
  24.      * {@inheritDoc}
  25.      */
  26.     public function getConfigTreeBuilder()
  27.     {
  28.         $treeBuilder = new TreeBuilder();
  29.         $rootNode $treeBuilder->root('mobile_detect');
  30.         $rootNode
  31.             ->children()
  32.                 ->arrayNode('redirect')
  33.                     ->addDefaultsIfNotSet()
  34.                     ->children()
  35.                         ->arrayNode('mobile')
  36.                             ->addDefaultsIfNotSet()
  37.                             ->children()
  38.                                 ->booleanNode('is_enabled')->defaultFalse()->end()
  39.                                 ->scalarNode('host')->defaultNull()->end()
  40.                                 ->scalarNode('status_code')->defaultValue(302)->cannotBeEmpty()->end()
  41.                                 ->scalarNode('action')->defaultValue(RequestResponseListener::REDIRECT)->cannotBeEmpty()->end()
  42.                             ->end()
  43.                         ->end()
  44.                         ->arrayNode('tablet')
  45.                             ->addDefaultsIfNotSet()
  46.                             ->children()
  47.                                 ->booleanNode('is_enabled')->defaultFalse()->end()
  48.                                 ->scalarNode('host')->defaultNull()->end()
  49.                                 ->scalarNode('status_code')->defaultValue(302)->cannotBeEmpty()->end()
  50.                                 ->scalarNode('action')->defaultValue(RequestResponseListener::REDIRECT)->cannotBeEmpty()->end()
  51.                             ->end()
  52.                         ->end()
  53.                         ->arrayNode('full')
  54.                             ->addDefaultsIfNotSet()
  55.                             ->children()
  56.                                 ->booleanNode('is_enabled')->defaultFalse()->end()
  57.                                 ->scalarNode('host')->defaultNull()->end()
  58.                                 ->scalarNode('status_code')->defaultValue(302)->cannotBeEmpty()->end()
  59.                                 ->scalarNode('action')->defaultValue(RequestResponseListener::REDIRECT)->cannotBeEmpty()->end()
  60.                             ->end()
  61.                         ->end()
  62.                         ->booleanNode('detect_tablet_as_mobile')->defaultFalse()->end()
  63.                     ->end()
  64.                 ->end()
  65.                 ->arrayNode('switch_device_view')
  66.                     ->addDefaultsIfNotSet()
  67.                     ->children()
  68.                         ->booleanNode('save_referer_path')->defaultTrue()->end()
  69.                     ->end()
  70.                 ->end()
  71.                 ->arrayNode('service')
  72.                     ->addDefaultsIfNotSet()
  73.                     ->children()
  74.                         ->scalarNode('mobile_detector')->defaultValue('mobile_detect.mobile_detector.default')->cannotBeEmpty()->end()
  75.                     ->end()
  76.                 ->end()
  77.                 ->scalarNode('cookie_key')->defaultValue(DeviceView::COOKIE_KEY_DEFAULT)->cannotBeEmpty()->end()
  78.                 ->scalarNode('cookie_path')->defaultValue(DeviceView::COOKIE_PATH_DEFAULT)->cannotBeEmpty()->end()
  79.                 ->scalarNode('cookie_domain')->defaultValue(DeviceView::COOKIE_DOMAIN_DEFAULT)->cannotBeEmpty()->end()
  80.                 ->booleanNode('cookie_secure')->defaultValue(DeviceView::COOKIE_SECURE_DEFAULT)->end()
  81.                 ->booleanNode('cookie_httponly')->defaultValue(DeviceView::COOKIE_HTTP_ONLY_DEFAULT)->end()
  82.                 ->scalarNode('cookie_expire_datetime_modifier')->defaultValue(DeviceView::COOKIE_EXPIRE_DATETIME_MODIFIER_DEFAULT)->cannotBeEmpty()->end()
  83.                 ->scalarNode('switch_param')->defaultValue(DeviceView::SWITCH_PARAM_DEFAULT)->cannotBeEmpty()->end()
  84.                 ->scalarNode('mobile_detector_class')->defaultValue('SunCat\MobileDetectBundle\DeviceDetector\MobileDetector')->cannotBeEmpty()->end()
  85.                 ->scalarNode('device_view_class')->defaultValue('SunCat\MobileDetectBundle\Helper\DeviceView')->cannotBeEmpty()->end()
  86.                 ->scalarNode('request_response_listener_class')->defaultValue('SunCat\MobileDetectBundle\EventListener\RequestResponseListener')->cannotBeEmpty()->end()
  87.                 ->scalarNode('twig_extension_class')->defaultValue('SunCat\MobileDetectBundle\Twig\Extension\MobileDetectExtension')->cannotBeEmpty()->end()
  88.             ->end();
  89.         return $treeBuilder;
  90.     }
  91. }