Test Setup Failed
Push — master ( 1595cb...1df194 )
by Kirill
02:11
created

TypeName   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 6
dl 0
loc 35
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A isGeneric() 0 3 1
A create() 0 3 1
A __construct() 0 5 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;
13
14
/**
15
 * Class TypeName
16
 */
17
class TypeName extends Identifier
18
{
19
    /**
20
     * @var array|Identifier[]
21
     */
22
    public array $arguments = [];
23
24
    /**
25
     * Name constructor.
26
     *
27
     * @param Identifier $name
28
     * @param array|Identifier[] $arguments
29
     */
30
    public function __construct(Identifier $name, array $arguments = [])
31
    {
32
        parent::__construct($name->value);
33
34
        $this->arguments = $arguments;
35
    }
36
37
    /**
38
     * @return bool
39
     */
40
    public function isGeneric(): bool
41
    {
42
        return $this->arguments !== [];
43
    }
44
45
    /**
46
     * @param array|Identifier[] $children
47
     * @return Identifier
48
     */
49
    public static function create($children): Identifier
50
    {
51
        return new static(\array_shift($children), $children);
52
    }
53
}
54