Passed
Push — master ( 43996d...1595cb )
by Kirill
04:07
created

NamedTypeContext   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 3
dl 0
loc 20
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A getName() 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\Type\NamedTypeInterface;
15
use Railt\SDL\Backend\Context;
16
use Railt\SDL\Frontend\Ast\Definition\Type\TypeDefinitionNode;
17
use Railt\TypeSystem\Schema;
18
19
/**
20
 * @property-read TypeDefinitionNode $ast
21
 * @method TypeDefinitionNode getAst()
22
 * @method NamedTypeInterface resolve(array $variables = [])
23
 */
24
abstract class NamedTypeContext extends DefinitionContext
25
{
26
    /**
27
     * NamedTypeContext constructor.
28
     *
29
     * @param Context $context
30
     * @param Schema $schema
31
     * @param TypeDefinitionNode $ast
32
     */
33
    public function __construct(Context $context, Schema $schema, TypeDefinitionNode $ast)
34
    {
35
        parent::__construct($context, $schema, $ast);
36
    }
37
38
    /**
39
     * @return string
40
     */
41
    public function getName(): string
42
    {
43
        return $this->ast->name->value;
44
    }
45
}
46