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

NamedDirectiveNode   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 4
dl 0
loc 24
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A create() 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\Frontend\Ast\Type;
13
14
use Railt\SDL\Frontend\Ast\Identifier;
15
use Railt\SDL\Frontend\Ast\Node;
16
17
/**
18
 * Class NamedTypeNode
19
 *
20
 * <code>
21
 *  export interface NamedTypeNode {
22
 *      readonly kind: 'NamedType';
23
 *      readonly loc?: Location;
24
 *      readonly name: IdentifierNode;
25
 *  }
26
 * </code>
27
 */
28
class NamedDirectiveNode extends TypeNode
29
{
30
    /**
31
     * @var Identifier
32
     */
33
    public Identifier $name;
34
35
    /**
36
     * NamedType constructor.
37
     *
38
     * @param Identifier $name
39
     */
40
    public function __construct(Identifier $name)
41
    {
42
        $this->name = $name;
43
    }
44
45
    /**
46
     * @param array|Node[] $children
47
     * @return static
48
     */
49
    public static function create(array $children): self
50
    {
51
        return new static($children[0]);
52
    }
53
}
54