Passed
Push — master ( 42be8d...38dc72 )
by Christoffer
02:59
created

ValidationProvider   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 1
dl 0
loc 21
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A register() 0 8 1
1
<?php
2
3
namespace Digia\GraphQL\Validation;
4
5
use Digia\GraphQL\Validation\Rule\RulesBuilder;
6
use Digia\GraphQL\Validation\Rule\RulesBuilderInterface;
7
use League\Container\ServiceProvider\AbstractServiceProvider;
8
9
class ValidationProvider extends AbstractServiceProvider
10
{
11
    /**
12
     * @var array
13
     */
14
    protected $provides = [
15
        ContextBuilderInterface::class,
16
        ValidatorInterface::class,
17
    ];
18
19
    /**
20
     * @inheritdoc
21
     */
22
    public function register()
23
    {
24
        $this->container->add(ContextBuilderInterface::class, ContextBuilder::class, true/* $shared */);
25
        $this->container->add(RulesBuilderInterface::class, RulesBuilder::class, true/* $shared */);
26
27
        $this->container->add(ValidatorInterface::class, Validator::class, true/* $shared */)
28
            ->withArgument(ContextBuilderInterface::class)
29
            ->withArgument(RulesBuilderInterface::class);
30
    }
31
}
32