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

NamedTypeContext::getName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
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