Test Failed
Push — master ( 3e22f3...90cc1b )
by Kirill
03:50
created

TypeDefinitionNode::getDescription()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
cc 2
nc 2
nop 0
dl 0
loc 7
ccs 0
cts 5
cp 0
crap 6
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * This file is part of Railt package.
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 */
8
declare(strict_types=1);
9
10
namespace Railt\SDL\Compiler\Ast\Definition;
11
12
use Railt\Parser\Ast\Rule;
13
use Railt\Reflection\Contracts\Definition\TypeDefinition;
14
use Railt\Reflection\Contracts\Document;
15
use Railt\SDL\Compiler\Ast\Common\DescriptionProvider;
16
use Railt\SDL\Compiler\Ast\Common\DirectivesProvider;
17
use Railt\SDL\Compiler\Ast\TypeNameNode;
18
19
/**
20
 * Class TypeDefinitionNode
21
 */
22
abstract class TypeDefinitionNode extends Rule
23
{
24
    use DescriptionProvider;
25
    use DirectivesProvider;
26
27
    /**
28
     * @return null|string
29
     */
30
    public function getTypeName(): ?string
31
    {
32
        /** @var TypeNameNode $name */
33
        $name = $this->first('TypeName', 1);
34
35
        return $name ? $name->getTypeName() : null;
36
    }
37
38
    /**
39
     * @param Document $document
40
     * @return TypeDefinition
41
     */
42
    abstract public function getTypeDefinition(Document $document): TypeDefinition;
43
}
44