getProviderDisplayName()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
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
use Sludio\HelperBundle\Oauth\Client\Client\DraugiemOAuth2Client;
7
use Sludio\HelperBundle\Oauth\Client\Provider\Draugiem\Draugiem;
8
9
class DraugiemProviderConfigurator implements ProviderConfiguratorInterface
10
{
11
    public function buildConfiguration(NodeBuilder $node)
12
    {
13
        // @formatter:off
14
        $node
15
            ->scalarNode('client_class')
16
                ->info('If you have a sub-class of OAuth2Client you want to use, add it here')
17
                ->defaultValue(DraugiemOAuth2Client::class)
18
            ->end()
19
            ->scalarNode('redirect_route')
0 ignored issues
show
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

19
            ->/** @scrutinizer ignore-call */ scalarNode('redirect_route')
Loading history...
20
                ->isRequired()
21
                ->cannotBeEmpty()
22
            ->end()
23
            ->arrayNode('provider_options')
24
                ->info('Other options to pass to your provider\'s constructor')
25
                ->prototype('variable')->end()
26
            ->end()
27
        ;
28
        // @formatter:on
29
    }
30
31
    public function getProviderClass(array $config)
32
    {
33
        return Draugiem::class;
34
    }
35
36
    public function getProviderOptions(array $config)
37
    {
38
        return array_merge([
39
            'clientId' => $config['client_id'],
40
            'clientSecret' => $config['client_secret'],
41
            'redirect_route' => $config['redirect_route'],
42
        ], $config['provider_options']);
43
    }
44
45
    public function getProviderDisplayName()
46
    {
47
        return 'Draugiem.lv';
48
    }
49
50
    public function getClientClass(array $config)
51
    {
52
        return $config['client_class'];
53
    }
54
}
55