Completed
Push — master ( aafecf...118f6e )
by
unknown
10s
created

Configuration::getConfigTreeBuilder()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 49
Code Lines 44

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 43
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 49
ccs 43
cts 43
cp 1
rs 9.2258
c 0
b 0
f 0
cc 1
eloc 44
nc 1
nop 0
crap 1
1
<?php
2
3
namespace MovingImage\Bundle\VMProApiBundle\DependencyInjection;
4
5
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
6
use Symfony\Component\Config\Definition\ConfigurationInterface;
7
8
/**
9
 * Class Configuration.
10
 *
11
 * @author Ruben Knol <[email protected]>
12
 */
13
class Configuration implements ConfigurationInterface
14
{
15
    /**
16
     * @const Which API base URL to use by default.
17
     */
18
    const DEFAULT_API_BASE_URL = 'https://api.video-cdn.net/v1/vms/';
19
20
    /**
21
     * @const Default OAuth URL (used for fetching and refreshing access token)
22
     */
23
    const DEFAULT_OAUTH_URL = 'https://login.movingimage.com/auth/realms/platform/protocol/openid-connect/token';
24
25
    /**
26
     * Build the configuration structure for this bundle.
27
     *
28
     * @return TreeBuilder
29
     */
30 12
    public function getConfigTreeBuilder()
31
    {
32 12
        $treeBuilder = new TreeBuilder();
33 12
        $rootNode = $treeBuilder->root('vm_pro_api');
34
35
        $rootNode
36 12
            ->children()
37 12
                ->scalarNode('base_url')
38 12
                    ->defaultValue(self::DEFAULT_API_BASE_URL)
39 12
                ->end()
40 12
                ->scalarNode('oauth_url')
41 12
                    ->defaultValue(self::DEFAULT_OAUTH_URL)
42 12
                ->end()
43 12
                ->scalarNode('default_vm_id')
44 12
                    ->defaultValue(0)
45 12
                ->end()
46 12
                ->arrayNode('credentials')
47 12
                    ->isRequired()
48 12
                    ->children()
49 12
                        ->scalarNode('username')->isRequired()->end()
50 12
                        ->scalarNode('password')->isRequired()->end()
51 12
                    ->end()
52 12
                ->end()
53 12
                ->arrayNode('rating_meta_data_fields')
54 12
                    ->children()
55 12
                        ->scalarNode('average')->isRequired()->end()
56 12
                        ->scalarNode('count')->isRequired()->end()
57 12
                    ->end()
58 12
                ->end()
59 12
                ->scalarNode('logger')
60 12
                    ->defaultValue(null)
61 12
                ->end()
62 12
                ->scalarNode('cache_pool')
63 12
                    ->defaultValue(null)
64 12
                ->end()
65 12
                ->scalarNode('cache_ttl')
66 12
                    ->defaultValue(null)
67 12
                ->end()
68 12
                ->scalarNode('cache_bypass_argument')
69 12
                    ->defaultValue(null)
70 12
                ->end()
71 12
                ->booleanNode('enable_stopwatch')
72 12
                    ->defaultValue(false)
73 12
                ->end()
74 12
            ->end()
75
        ;
76
77 12
        return $treeBuilder;
78
    }
79
}
80