Configuration   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 1
c 0
b 0
f 0
lcom 0
cbo 3
dl 0
loc 35
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A getConfigTreeBuilder() 0 32 1
1
<?php
2
3
/**
4
 * Copyright 2014 SURFnet bv
5
 *
6
 * Licensed under the Apache License, Version 2.0 (the "License");
7
 * you may not use this file except in compliance with the License.
8
 * You may obtain a copy of the License at
9
 *
10
 *     http://www.apache.org/licenses/LICENSE-2.0
11
 *
12
 * Unless required by applicable law or agreed to in writing, software
13
 * distributed under the License is distributed on an "AS IS" BASIS,
14
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
 * See the License for the specific language governing permissions and
16
 * limitations under the License.
17
 */
18
19
namespace Surfnet\StepupMiddlewareClientBundle\DependencyInjection;
20
21
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
22
use Symfony\Component\Config\Definition\ConfigurationInterface;
23
24
/**
25
 * @codeCoverageIgnore
26
 */
27
class Configuration implements ConfigurationInterface
28
{
29
    public function getConfigTreeBuilder()
30
    {
31
        $treeBuilder = new TreeBuilder;
32
33
        $treeBuilder
0 ignored issues
show
Deprecated Code introduced by
The method Symfony\Component\Config...der\TreeBuilder::root() has been deprecated with message: since Symfony 4.3, pass the root name to the constructor instead

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
34
            ->root('surfnet_stepup_middleware_client')
35
            ->children()
36
                ->arrayNode('authorisation')
37
                    ->info('Middleware API Credentials')
38
                    ->children()
39
                        ->scalarNode('username')->isRequired()->end()
40
                        ->scalarNode('password')->isRequired()->end()
41
                    ->end()
42
                ->end()
43
                ->arrayNode('url')
44
                    ->children()
45
                        ->scalarNode('command_api')->isRequired()->end()
46
                        ->scalarNode('api')
47
                            ->isRequired()
48
                            ->validate()
49
                                ->ifTrue(function ($url) {
50
                                    return !preg_match('~/$~', $url);
51
                                })
52
                                ->thenInvalid("API URL must end with a forward slash, got '%s'")
53
                            ->end()
54
                        ->end()
55
                    ->end()
56
                ->end()
57
            ->end();
58
59
        return $treeBuilder;
60
    }
61
}
62