Terminal   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 2
dl 0
loc 27
ccs 0
cts 9
cp 0
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A build() 0 4 1
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