Failed Conditions
Push — ng ( efd567...e5f725 )
by Florent
04:15
created

ServicesSource::load()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 2
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\DependencyInjection\Component\Core;
15
16
use OAuth2Framework\Bundle\DependencyInjection\Component\Component;
17
use Symfony\Component\Config\Definition\Builder\NodeDefinition;
18
use Symfony\Component\Config\FileLocator;
19
use Symfony\Component\DependencyInjection\ContainerBuilder;
20
use Symfony\Component\DependencyInjection\Loader\PhpFileLoader;
21
22
final class ServicesSource implements Component
23
{
24
    /**
25
     * {@inheritdoc}
26
     */
27
    public function name(): string
28
    {
29
        return 'route_loader';
30
    }
31
32
    /**
33
     * {@inheritdoc}
34
     */
35
    public function load(array $configs, ContainerBuilder $container)
36
    {
37
        $container->setParameter('oauth2_server.server_uri', $configs['server_uri']);
38
39
        $loader = new PhpFileLoader($container, new FileLocator(__DIR__.'/../../../Resources/config/core'));
40
        $loader->load('services.php');
41
    }
42
43
    /**
44
     * {@inheritdoc}
45
     */
46
    public function getNodeDefinition(NodeDefinition $node)
47
    {
48
        $node->children()
49
                ->scalarNode('server_uri')
50
                    ->info('The URI of this server')
51
                    ->isRequired()
52
                ->end()
53
            ->end();
54
    }
55
56
    /**
57
     * {@inheritdoc}
58
     */
59
    public function prepend(ContainerBuilder $container, array $config): array
60
    {
61
        //Nothing to do
62
        return [];
63
    }
64
}
65