Failed Conditions
Push — ng ( c00098...4b490a )
by Florent
06:57
created

name()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * The MIT License (MIT)
7
 *
8
 * Copyright (c) 2014-2018 Spomky-Labs
9
 *
10
 * This software may be modified and distributed under the terms
11
 * of the MIT license.  See the LICENSE file for details.
12
 */
13
14
namespace OAuth2Framework\Bundle\Component\Endpoint;
15
16
use Fluent\PhpConfigFileLoader;
17
use OAuth2Framework\Bundle\Component\Component;
18
use Symfony\Component\Config\Definition\Builder\NodeDefinition;
19
use Symfony\Component\Config\FileLocator;
20
use Symfony\Component\DependencyInjection\ContainerBuilder;
21
22
class AuthorizationEndpointPreConfiguredAuthorizationSource implements Component
0 ignored issues
show
Bug introduced by
There is at least one abstract method in this class. Maybe declare it as abstract, or implement the remaining methods: build, load, prepend
Loading history...
23
{
24
    /**
25
     * {@inheritdoc}
26
     */
27
    protected function continueLoading(string $path, ContainerBuilder $container, array $config)
28
    {
29
        $container->setAlias($path.'.event_store', $config['event_store']);
30
31
        $loader = new PhpConfigFileLoader($container, new FileLocator(__DIR__.'/../../Resources/config/endpoint'));
32
        $loader->load('pre_configured_authorization.php');
33
    }
34
35
    /**
36
     * {@inheritdoc}
37
     */
38
    public function name(): string
39
    {
40
        return 'pre_configured_authorization';
41
    }
42
43
    /**
44
     * {@inheritdoc}
45
     */
46
    public function getNodeDefinition(NodeDefinition $node)
47
    {
48
        $node
49
            ->validate()
50
                ->ifTrue(function ($config) {
51
                    return true === $config['enabled'] && empty($config['event_store']);
52
                })
53
                ->thenInvalid('The option "event_store" must be set.')
54
            ->end()
55
            ->children()
56
                ->scalarNode('event_store')->defaultNull()->end()
57
            ->end();
58
    }
59
}
60