Issues (1)

src/DependencyInjection/Configuration.php (1 issue)

Labels
Severity
1
<?php
2
3
declare(strict_types = 1);
4
5
/**
6
 * Copyright 2014 SURFnet bv
7
 *
8
 * Licensed under the Apache License, Version 2.0 (the "License");
9
 * you may not use this file except in compliance with the License.
10
 * You may obtain a copy of the License at
11
 *
12
 *     http://www.apache.org/licenses/LICENSE-2.0
13
 *
14
 * Unless required by applicable law or agreed to in writing, software
15
 * distributed under the License is distributed on an "AS IS" BASIS,
16
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
 * See the License for the specific language governing permissions and
18
 * limitations under the License.
19
 */
20
21
namespace Surfnet\YubikeyApiClientBundle\DependencyInjection;
22
23
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
24
use Symfony\Component\Config\Definition\ConfigurationInterface;
25
26
/**
27
 * @codeCoverageIgnore
28
 */
29
class Configuration implements ConfigurationInterface
30
{
31
    public function getConfigTreeBuilder(): TreeBuilder
32
    {
33
        $treeBuilder = new TreeBuilder('surfnet_yubikey_api_client');
34
35
        $rootNode = $treeBuilder->getRootNode();
36
        $rootNode
37
            ->children()
38
                ->arrayNode('credentials')
39
                    ->info('YubiKey API Credentials')
40
                    ->children()
41
                        ->scalarNode('client_id')
42
                            ->info('Client ID for the YubiKey API')
43
                            ->isRequired()
44
                            ->validate()
45
                                ->ifTrue(fn($value) => (!is_string($value) && !is_int($value)) || trim((string)$value) === '')
46
                                ->thenInvalid('Invalid YubiKey API Client ID specified: "%s"')
47
                            ->end()
48
                        ->end()
49
                        ->scalarNode('client_secret')
0 ignored issues
show
The method scalarNode() does not exist on Symfony\Component\Config...der\NodeParentInterface. It seems like you code against a sub-type of Symfony\Component\Config...der\NodeParentInterface such as Symfony\Component\Config...ion\Builder\NodeBuilder. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

49
                        ->/** @scrutinizer ignore-call */ scalarNode('client_secret')
Loading history...
50
                            ->info('Secret for the YubiKey API')
51
                            ->isRequired()
52
                            ->validate()
53
                                ->ifTrue(fn($value) => !is_string($value) || trim($value) === '')
54
                                ->thenInvalid('Invalid YubiKey API secret specified: "%s"')
55
                            ->end()
56
                        ->end()
57
                    ->end()
58
                ->end()
59
            ->end();
60
61
        return $treeBuilder;
62
    }
63
}
64