PageRenderTime 19ms CodeModel.GetById 7ms app.highlight 6ms RepoModel.GetById 2ms app.codeStats 0ms

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