Failed Conditions
Push — master ( b8d841...bc596e )
by Florent
28:20
created

Configuration::getConfigTreeBuilder()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 27

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 27
rs 9.488
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * The MIT License (MIT)
7
 *
8
 * Copyright (c) 2014-2018 Spomky-Labs
9
 *
10
 * This software may be modified and distributed under the terms
11
 * of the MIT license.  See the LICENSE file for details.
12
 */
13
14
namespace OAuth2Framework\WebFingerBundle\DependencyInjection;
15
16
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
17
use Symfony\Component\Config\Definition\ConfigurationInterface;
18
19
class Configuration implements ConfigurationInterface
20
{
21
    /**
22
     * @var string
23
     */
24
    private $alias;
25
26
    /**
27
     * Configuration constructor.
28
     */
29
    public function __construct(string $alias)
30
    {
31
        $this->alias = $alias;
32
    }
33
34
    public function getConfigTreeBuilder()
35
    {
36
        $treeBuilder = new TreeBuilder();
37
        $rootNode = $treeBuilder->root($this->alias);
38
39
        $rootNode
40
            ->children()
41
            ->scalarNode('response_factory')
42
            ->info('The response factory service')
43
            ->isRequired()
44
            ->end()
45
            ->scalarNode('resource_repository')
46
            ->info('The resource repository service')
47
            ->isRequired()
48
            ->end()
49
            ->scalarNode('host')
50
            ->info('The host of the server (e.g. example.com, my-service.net)')
51
            ->isRequired()
52
            ->end()
53
            ->scalarNode('path')
54
            ->info('The path to the issuer discovery endpoint. Should be "/.well-known/webfinger" for compliance with the RFC7033.')
55
            ->defaultValue('/.well-known/webfinger')
56
            ->end()
57
            ->end();
58
59
        return $treeBuilder;
60
    }
61
}
62