Completed
Push — master ( a7a918...731c42 )
by Alexandr
03:36
created

ResolveInfo   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 66
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 6
lcom 2
cbo 2
dl 0
loc 66
ccs 15
cts 15
cp 1
rs 10
c 0
b 0
f 0

6 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 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 28
    public function __construct(AbstractField $field, array $fieldASTList, ExecutionContextInterface $executionContext)
37
    {
38 28
        $this->field            = $field;
39 28
        $this->fieldASTList     = $fieldASTList;
40 28
        $this->executionContext = $executionContext;
41 28
    }
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 4
    public function getReturnType()
71
    {
72 4
        return $this->field->getType();
73
    }
74
75 1
    public function getContainer()
76
    {
77 1
        return $this->executionContext->getContainer();
78
    }
79
80
81
}
82