Failed Conditions
Pull Request — master (#28)
by Yo
03:05
created

JsonRpcParamsValidatorExtension   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Test Coverage

Coverage 84.62%

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getNamespace() 0 3 1
A getAlias() 0 3 1
A load() 0 8 1
A getXsdValidationBasePath() 0 3 1
1
<?php
2
namespace Yoanm\SymfonyJsonRpcParamsValidator\DependencyInjection;
3
4
use Symfony\Component\Config\FileLocator;
5
use Symfony\Component\DependencyInjection\ContainerBuilder;
1 ignored issue
show
Bug introduced by
The type Symfony\Component\Depend...ection\ContainerBuilder was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
use Symfony\Component\DependencyInjection\Extension\ExtensionInterface;
7
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
8
9
/**
10
 * Class JsonRpcParamsValidatorExtension
11
 */
12
class JsonRpcParamsValidatorExtension implements ExtensionInterface
13
{
14
    // Extension identifier (used in configuration for instance)
15
    const EXTENSION_IDENTIFIER = 'json_rpc_params_validator';
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 1
        );
26 1
        $loader->load('services.public.yaml');
27 1
        $loader->load('services.sdk.infra.yaml');
28
    }
29
30
    /**
31
     * {@inheritdoc}
32
     */
33 1
    public function getNamespace()
34
    {
35 1
        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 1
    public function getAlias()
50
    {
51 1
        return self::EXTENSION_IDENTIFIER;
52
    }
53
}
54