GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Configuration   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 3
dl 0
loc 52
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getConfigTreeBuilder() 0 17 2
A addApiSection() 0 16 1
A addHttpClientSection() 0 14 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * (c) Christian Gripp <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Core23\LastFmBundle\DependencyInjection;
13
14
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
15
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
16
use Symfony\Component\Config\Definition\ConfigurationInterface;
17
18
final class Configuration implements ConfigurationInterface
19
{
20
    public function getConfigTreeBuilder()
21
    {
22
        $treeBuilder = new TreeBuilder('core23_lastfm');
23
24
        // Keep compatibility with symfony/config < 4.2
25
        if (!method_exists(TreeBuilder::class, 'getRootNode')) {
26
            $rootNode = $treeBuilder->root('core23_lastfm');
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...
27
        } else {
28
            $rootNode = $treeBuilder->getRootNode();
29
        }
30
        \assert($rootNode instanceof ArrayNodeDefinition);
31
32
        $this->addApiSection($rootNode);
33
        $this->addHttpClientSection($rootNode);
34
35
        return $treeBuilder;
36
    }
37
38
    private function addApiSection(ArrayNodeDefinition $node): void
39
    {
40
        $node
41
            ->children()
42
                ->arrayNode('api')
43
                    ->addDefaultsIfNotSet()
44
                    ->children()
45
                        ->scalarNode('app_id')->isRequired()->end()
46
                        ->scalarNode('shared_secret')->isRequired()->end()
47
                        ->scalarNode('endpoint')->defaultValue('http://ws.audioscrobbler.com/2.0/')->end()
48
                        ->scalarNode('auth_url')->defaultValue('http://www.last.fm/api/auth/')->end()
49
                    ->end()
50
                ->end()
51
            ->end()
52
        ;
53
    }
54
55
    private function addHttpClientSection(ArrayNodeDefinition $node): void
56
    {
57
        $node
58
            ->children()
59
                ->arrayNode('http')
60
                    ->addDefaultsIfNotSet()
61
                    ->children()
62
                        ->scalarNode('client')->defaultNull()->end()
63
                        ->scalarNode('message_factory')->defaultNull()->end()
64
                    ->end()
65
                ->end()
66
            ->end()
67
        ;
68
    }
69
}
70