Completed
Push — master ( 35ad38...5d4aad )
by Alexandr
03:22
created

ResolveInfo   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 71
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 72.21%

Importance

Changes 5
Bugs 1 Features 1
Metric Value
wmc 7
c 5
b 1
f 1
lcom 1
cbo 1
dl 0
loc 71
ccs 13
cts 18
cp 0.7221
rs 10

7 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getExecutionContext() 0 4 1
A getField() 0 4 1
A getFieldASTList() 0 4 1
A getReturnType() 0 4 1
A setContainer() 0 4 1
A getContainer() 0 4 1
1
<?php
2
/*
3
* This file is a part of GraphQL project.
4
*
5
* @author Alexandr Viniychuk <[email protected]>
6
* created: 5/19/16 8:58 AM
7
*/
8
9
namespace Youshido\GraphQL\Execution;
10
11
use Youshido\GraphQL\Execution\Context\ExecutionContextInterface;
12
use Youshido\GraphQL\Field\AbstractField;
13
use Youshido\GraphQL\Parser\Ast\Field;
14
use Youshido\GraphQL\Type\AbstractType;
15
16
class ResolveInfo
17
{
18
    /** @var  AbstractField */
19
    protected $field;
20
21
    /** @var Field[] */
22
    protected $fieldASTList;
23
24
    /** @var ExecutionContextInterface */
25
    protected $executionContext;
26
27
    /**
28
     * This property is to be used for DI in various scenario
29
     * Added to original class to keep backward compatibility
30
     * because of the way AbstractField::resolve has been declared
31
     *
32
     * @var mixed $container
33
     */
34
    protected $container;
35
36 26
    public function __construct(AbstractField $field, array $fieldASTList, ExecutionContextInterface $executionContext)
37
    {
38 26
        $this->field            = $field;
39 26
        $this->fieldASTList     = $fieldASTList;
40 26
        $this->executionContext = $executionContext;
41 26
    }
42
43
    /**
44
     * @return ExecutionContextInterface
45
     */
46 9
    public function getExecutionContext()
47
    {
48 9
        return $this->executionContext;
49
    }
50
51
    /**
52
     * @return AbstractField
53
     */
54 1
    public function getField()
55
    {
56 1
        return $this->field;
57
    }
58
59
    /**
60
     * @return Field[]
61
     */
62 1
    public function getFieldASTList()
63
    {
64 1
        return $this->fieldASTList;
65
    }
66
67
    /**
68
     * @return AbstractType
69
     */
70 3
    public function getReturnType()
71
    {
72 3
        return $this->field->getType();
73
    }
74
75
    public function setContainer($container)
76
    {
77
        $this->container = $container;
78
    }
79
80
    public function getContainer()
81
    {
82
        return $this->container;
83
    }
84
85
86
}
87