Terminal::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 0
cts 5
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 3
crap 2
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\Compiler\Grammar\Builder;
11
12
use Railt\Parser\Rule\Rule;
13
use Railt\Parser\Rule\Terminal as TerminalRule;
14
15
/**
16
 * Class Terminal
17
 */
18
class Terminal extends AbstractBuilder
19
{
20
    /**
21
     * @var bool
22
     */
23
    private $kept;
24
25
    /**
26
     * Terminal constructor.
27
     * @param $name
28
     * @param string $tokenName
29
     * @param bool $kept
30
     */
31
    public function __construct($name, string $tokenName, bool $kept = false)
32
    {
33
        $this->kept = $kept;
34
        parent::__construct($name, null, $tokenName);
35
    }
36
37
    /**
38
     * @return Rule
39
     */
40
    public function build(): Rule
41
    {
42
        return new TerminalRule($this->name, $this->nodeId, $this->kept);
43
    }
44
}
45