JsonRpcHttpServerOpenAPIDocExtension   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 11
c 1
b 0
f 0
dl 0
loc 41
ccs 14
cts 14
cp 1
rs 10
wmc 4

4 Methods

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