Passed
Push — master ( 8eea92...da79af )
by Dāvis
03:03
created

FacebookProviderConfigurator::buildConfiguration()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 20
Code Lines 17

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 17
nc 1
nop 1
dl 0
loc 20
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace Sludio\HelperBundle\Oauth\Configurator;
4
5
use Symfony\Component\Config\Definition\Builder\NodeBuilder;
6
7
class FacebookProviderConfigurator implements ProviderConfiguratorInterface
8
{
9
    public function buildConfiguration(NodeBuilder $node)
10
    {
11
        // @formatter:off
12
        $node
13
            ->scalarNode('graph_api_version')
14
                ->isRequired()
15
                ->defaultValue('v2.4')
16
            ->end()
17
            ->scalarNode('client_class')
0 ignored issues
show
Bug introduced by
The method scalarNode() does not exist on Symfony\Component\Config...\VariableNodeDefinition. ( Ignorable by Annotation )

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

17
            ->/** @scrutinizer ignore-call */ scalarNode('client_class')

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
Bug introduced by
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

17
            ->/** @scrutinizer ignore-call */ scalarNode('client_class')
Loading history...
Bug introduced by
The method scalarNode() does not exist on Symfony\Component\Config...der\ArrayNodeDefinition. ( Ignorable by Annotation )

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

17
            ->/** @scrutinizer ignore-call */ scalarNode('client_class')

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
Bug introduced by
The method scalarNode() does not exist on Symfony\Component\Config...\Builder\NodeDefinition. ( Ignorable by Annotation )

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

17
            ->/** @scrutinizer ignore-call */ scalarNode('client_class')

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
18
                ->info('If you have a sub-class of OAuth2Client you want to use, add it here')
19
                ->defaultValue('Sludio\HelperBundle\Oauth\Client\OAuth2Client')
20
            ->end()
21
            ->scalarNode('redirect_route')
22
                ->isRequired()
23
                ->cannotBeEmpty()
24
            ->end()
25
            ->arrayNode('provider_options')
0 ignored issues
show
Bug introduced by
The method arrayNode() does not exist on Symfony\Component\Config...\VariableNodeDefinition. ( Ignorable by Annotation )

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

25
            ->/** @scrutinizer ignore-call */ arrayNode('provider_options')

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
Bug introduced by
The method arrayNode() 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

25
            ->/** @scrutinizer ignore-call */ arrayNode('provider_options')
Loading history...
Bug introduced by
The method arrayNode() does not exist on Symfony\Component\Config...\Builder\NodeDefinition. ( Ignorable by Annotation )

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

25
            ->/** @scrutinizer ignore-call */ arrayNode('provider_options')

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
Bug introduced by
The method arrayNode() does not exist on Symfony\Component\Config...der\ArrayNodeDefinition. ( Ignorable by Annotation )

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

25
            ->/** @scrutinizer ignore-call */ arrayNode('provider_options')

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
26
                ->info('Other options to pass to your provider\'s constructor')
27
                ->prototype('variable')->end()
28
            ->end()
0 ignored issues
show
Bug introduced by
The method end() does not exist on Symfony\Component\Config...der\NodeParentInterface. It seems like you code against a sub-type of said class. However, the method does not exist in Symfony\Component\Config...ion\Builder\TreeBuilder. Are you sure you never get one of those? ( Ignorable by Annotation )

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

28
            ->/** @scrutinizer ignore-call */ end()
Loading history...
29
        ;
30
        // @formatter:on
31
    }
32
33
    public function getProviderClass(array $config)
34
    {
35
        return 'Sludio\HelperBundle\Oauth\Client\Provider\Facebook\Facebook';
36
    }
37
38
    public function getProviderOptions(array $config)
39
    {
40
        return array_merge([
41
            'clientId' => $config['client_id'],
42
            'clientSecret' => $config['client_secret'],
43
            'graphApiVersion' => $config['graph_api_version'],
44
            'redirect_route' => $config['redirect_route'],
45
        ], $config['provider_options']);
46
    }
47
48
    public function getProviderDisplayName()
49
    {
50
        return 'Facebook';
51
    }
52
53
    public function getClientClass(array $config)
54
    {
55
        return $config['client_class'];
56
    }
57
}
58