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

UserAccountSource::prepend()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 2
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\Component\Core;
15
16
use OAuth2Framework\Bundle\Component\Component;
17
use Symfony\Component\Config\Definition\Builder\NodeDefinition;
18
use Symfony\Component\DependencyInjection\ContainerBuilder;
19
20
class UserAccountSource implements Component
21
{
22
    /**
23
     * {@inheritdoc}
24
     */
25
    public function name(): string
26
    {
27
        return 'user_account';
28
    }
29
30
    /**
31
     * {@inheritdoc}
32
     */
33
    public function load(array $configs, ContainerBuilder $container)
34
    {
35
        $container->setAlias('oauth2_server.user_account.repository', $configs['user_account_repository']);
36
        $container->setAlias('oauth2_server.user_account.manager', $configs['user_account_manager']);
37
    }
38
39
    /**
40
     * {@inheritdoc}
41
     */
42
    public function getNodeDefinition(NodeDefinition $node)
43
    {
44
        $node->children()
45
            ->scalarNode('user_account_repository')
46
                ->info('The user account repository service')
47
                ->isRequired()
48
            ->end()
49
            ->scalarNode('user_account_manager')
50
                ->info('The user_account manager service')
51
                ->isRequired()
52
            ->end()
53
        ;
54
    }
55
56
    /**
57
     * {@inheritdoc}
58
     */
59
    public function build(ContainerBuilder $container)
60
    {
61
        //Nothing to do
62
    }
63
64
    /**
65
     * {@inheritdoc}
66
     */
67
    public function prepend(ContainerBuilder $container, array $config): array
68
    {
69
        //Nothing to do
70
        return [];
71
    }
72
}
73