Completed
Push — master ( 0f7b0a...750008 )
by Christoffer
02:09
created

ValidationProvider::register()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 0
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace Digia\GraphQL\Provider;
4
5
use Digia\GraphQL\Validation\ContextBuilder;
6
use Digia\GraphQL\Validation\ContextBuilderInterface;
7
use Digia\GraphQL\Validation\Validator;
8
use Digia\GraphQL\Validation\ValidatorInterface;
9
use League\Container\ServiceProvider\AbstractServiceProvider;
10
11
class ValidationProvider extends AbstractServiceProvider
12
{
13
    /**
14
     * @var array
15
     */
16
    protected $provides = [
17
        ContextBuilderInterface::class,
18
        ValidatorInterface::class,
19
    ];
20
21
    /**
22
     * @inheritdoc
23
     */
24
    public function register()
25
    {
26
        $this->container->add(ContextBuilderInterface::class, ContextBuilder::class, true/* $shared */);
27
28
        $this->container->add(ValidatorInterface::class, Validator::class, true/* $shared */)
29
            ->withArgument(ContextBuilderInterface::class);
30
    }
31
}
32