Passed
Push — master ( 81686d...1595cb )
by Kirill
04:41
created

CompiledTypeContext   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 5
dl 0
loc 31
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getName() 0 3 1
A __construct() 0 3 1
A resolve() 0 3 1
1
<?php
2
3
/**
4
 * This file is part of Railt package.
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 */
9
10
declare(strict_types=1);
11
12
namespace Railt\SDL\Backend\Context;
13
14
use GraphQL\Contracts\TypeSystem\DefinitionInterface;
15
use GraphQL\Contracts\TypeSystem\Type\NamedTypeInterface;
16
17
/**
18
 * Class CompiledTypeContext
19
 */
20
class CompiledTypeContext implements DefinitionContextInterface
21
{
22
    /**
23
     * @var NamedTypeInterface
24
     */
25
    private NamedTypeInterface $type;
26
27
    /**
28
     * CompiledTypeContext constructor.
29
     *
30
     * @param NamedTypeInterface $type
31
     */
32
    public function __construct(NamedTypeInterface $type)
33
    {
34
        $this->type = $type;
35
    }
36
37
    /**
38
     * {@inheritDoc}
39
     */
40
    public function getName(): string
41
    {
42
        return $this->type->getName();
43
    }
44
45
    /**
46
     * {@inheritDoc}
47
     */
48
    public function resolve(array $variables = []): DefinitionInterface
49
    {
50
        return $this->type;
51
    }
52
}
53