Passed
Push — release/0.1.0 ( b74469...8bca68 )
by Yo
03:12
created

JsonRpcHttpServerSwaggerDocExtension   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 40
ccs 0
cts 20
cp 0
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A load() 0 8 1
A getAlias() 0 3 1
A getNamespace() 0 3 1
A getXsdValidationBasePath() 0 3 1
1
<?php
2
namespace Yoanm\SymfonyJsonRpcHttpServerSwaggerDoc\DependencyInjection;
3
4
use Symfony\Component\Config\FileLocator;
5
use Symfony\Component\DependencyInjection\ContainerBuilder;
6
use Symfony\Component\DependencyInjection\Extension\ExtensionInterface;
7
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
8
9
/**
10
 * Class JsonRpcHttpServerSwaggerDocExtension
11
 */
12
class JsonRpcHttpServerSwaggerDocExtension implements ExtensionInterface
13
{
14
    // Extension identifier (used in configuration for instance)
15
    const EXTENSION_IDENTIFIER = 'json_rpc_http_server_swagger_doc';
16
17
    /**
18
     * {@inheritdoc}
19
     */
20
    public function load(array $configs, ContainerBuilder $container)
21
    {
22
        $loader = new YamlFileLoader(
23
            $container,
24
            new FileLocator(__DIR__.'/../Resources/config')
25
        );
26
        $loader->load('services.sdk.yaml');
27
        $loader->load('services.public.yaml');
28
    }
29
30
    /**
31
     * {@inheritdoc}
32
     */
33
    public function getNamespace()
34
    {
35
        return 'http://example.org/schema/dic/'.$this->getAlias();
36
    }
37
38
    /**
39
     * {@inheritdoc}
40
     */
41
    public function getXsdValidationBasePath()
42
    {
43
        return '';
44
    }
45
46
    /**
47
     * {@inheritdoc}
48
     */
49
    public function getAlias()
50
    {
51
        return self::EXTENSION_IDENTIFIER;
52
    }
53
}
54