FieldsBuilderFactory   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 60
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 24
dl 0
loc 60
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A buildFieldsBuilder() 0 11 1
A __construct() 0 12 1
1
<?php
2
3
4
namespace TheCodingMachine\GraphQL\Controllers;
5
6
7
use TheCodingMachine\GraphQL\Controllers\Hydrators\HydratorInterface;
8
use TheCodingMachine\GraphQL\Controllers\Mappers\RecursiveTypeMapperInterface;
9
use TheCodingMachine\GraphQL\Controllers\Reflection\CachedDocBlockFactory;
10
use TheCodingMachine\GraphQL\Controllers\Security\AuthenticationServiceInterface;
11
use TheCodingMachine\GraphQL\Controllers\Security\AuthorizationServiceInterface;
12
use TheCodingMachine\GraphQL\Controllers\Types\TypeResolver;
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 CachedDocBlockFactory
34
     */
35
    private $cachedDocBlockFactory;
36
    /**
37
     * @var TypeResolver
38
     */
39
    private $typeResolver;
40
    /**
41
     * @var NamingStrategyInterface
42
     */
43
    private $namingStrategy;
44
45
    public function __construct(AnnotationReader $annotationReader,
46
                                HydratorInterface $hydrator, AuthenticationServiceInterface $authenticationService,
47
                                AuthorizationServiceInterface $authorizationService, TypeResolver $typeResolver,
48
                                CachedDocBlockFactory $cachedDocBlockFactory, NamingStrategyInterface $namingStrategy)
49
    {
50
        $this->annotationReader = $annotationReader;
51
        $this->hydrator = $hydrator;
52
        $this->authenticationService = $authenticationService;
53
        $this->authorizationService = $authorizationService;
54
        $this->typeResolver = $typeResolver;
55
        $this->cachedDocBlockFactory = $cachedDocBlockFactory;
56
        $this->namingStrategy = $namingStrategy;
57
    }
58
59
    /**
60
     * @param RecursiveTypeMapperInterface $typeMapper
61
     * @return FieldsBuilder
62
     */
63
    public function buildFieldsBuilder(RecursiveTypeMapperInterface $typeMapper): FieldsBuilder
64
    {
65
        return new FieldsBuilder(
66
            $this->annotationReader,
67
            $typeMapper,
68
            $this->hydrator,
69
            $this->authenticationService,
70
            $this->authorizationService,
71
            $this->typeResolver,
72
            $this->cachedDocBlockFactory,
73
            $this->namingStrategy
74
        );
75
    }
76
}
77