Completed
Push — master ( 30514f...e0ab72 )
by Christoffer
02:37
created

DefinitionBuilderCreator   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
dl 0
loc 31
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A create() 0 6 1
1
<?php
2
3
namespace Digia\GraphQL\SchemaBuilder;
4
5
use Digia\GraphQL\Execution\ValuesResolver;
6
use Psr\SimpleCache\CacheInterface;
7
use Psr\SimpleCache\InvalidArgumentException;
8
9
class DefinitionBuilderCreator implements DefinitionBuilderCreatorInterface
10
{
11
    /**
12
     * @var CacheInterface
13
     */
14
    protected $cache;
15
16
    /**
17
     * @var ValuesResolver
18
     */
19
    protected $valuesResolver;
20
21
    /**
22
     * DefinitionBuilderCreator constructor.
23
     */
24
    public function __construct(CacheInterface $cache, ValuesResolver $valuesResolver)
25
    {
26
        $this->cache          = $cache;
27
        $this->valuesResolver = $valuesResolver;
28
    }
29
30
    /**
31
     * @inheritdoc
32
     * @throws InvalidArgumentException
33
     */
34
    public function create(
35
        array $typeDefinitionsMap,
36
        array $resolverMap,
37
        ?callable $resolveTypeFunction = null
38
    ): DefinitionBuilderInterface {
39
        return new DefinitionBuilder($typeDefinitionsMap, $resolverMap, null, $this->cache, $this->valuesResolver);
40
    }
41
}
42