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

DefinitionBuilderCreator::create()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 1
nc 1
nop 3
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