Completed
Push — master ( ab2a5d...d6b376 )
by David
17s
created

FieldsBuilderFactory::buildFieldsBuilder()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 10
rs 10
c 0
b 0
f 0
nc 1
nop 1
cc 1
1
<?php
2
3
4
namespace TheCodingMachine\GraphQL\Controllers;
5
6
7
use Psr\Container\ContainerInterface;
8
use TheCodingMachine\GraphQL\Controllers\Hydrators\HydratorInterface;
9
use TheCodingMachine\GraphQL\Controllers\Mappers\RecursiveTypeMapperInterface;
10
use TheCodingMachine\GraphQL\Controllers\Reflection\CachedDocBlockFactory;
11
use TheCodingMachine\GraphQL\Controllers\Security\AuthenticationServiceInterface;
12
use TheCodingMachine\GraphQL\Controllers\Security\AuthorizationServiceInterface;
13
14
class FieldsBuilderFactory
15
{
16
    /**
17
     * @var AnnotationReader
18
     */
19
    private $annotationReader;
20
    /**
21
     * @var HydratorInterface
22
     */
23
    private $hydrator;
24
    /**
25
     * @var AuthenticationServiceInterface
26
     */
27
    private $authenticationService;
28
    /**
29
     * @var AuthorizationServiceInterface
30
     */
31
    private $authorizationService;
32
    /**
33
     * @var ContainerInterface
34
     */
35
    private $registry;
36
    /**
37
     * @var CachedDocBlockFactory
38
     */
39
    private $cachedDocBlockFactory;
40
41
    public function __construct(AnnotationReader $annotationReader,
42
                                HydratorInterface $hydrator, AuthenticationServiceInterface $authenticationService,
43
                                AuthorizationServiceInterface $authorizationService, ContainerInterface $registry,
44
                                CachedDocBlockFactory $cachedDocBlockFactory)
45
    {
46
        $this->annotationReader = $annotationReader;
47
        $this->hydrator = $hydrator;
48
        $this->authenticationService = $authenticationService;
49
        $this->authorizationService = $authorizationService;
50
        $this->registry = $registry;
51
        $this->cachedDocBlockFactory = $cachedDocBlockFactory;
52
    }
53
54
    /**
55
     * @param RecursiveTypeMapperInterface $typeMapper
56
     * @return FieldsBuilder
57
     */
58
    public function buildFieldsBuilder(RecursiveTypeMapperInterface $typeMapper): FieldsBuilder
59
    {
60
        return new FieldsBuilder(
61
            $this->annotationReader,
62
            $typeMapper,
63
            $this->hydrator,
64
            $this->authenticationService,
65
            $this->authorizationService,
66
            $this->registry,
67
            $this->cachedDocBlockFactory
68
        );
69
    }
70
}
71