Completed
Push — master ( 88ff28...2dc58f )
by Kirill
06:03
created

TokenBuilder   A

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\Reader\Resolver\Builder;
11
use Railt\Parser\Rule\Symbol;
12
use Railt\Parser\Rule\Token;
13
14
/**
15
 * Class TokenBuilder
16
 */
17
class TokenBuilder extends Builder
18
{
19
    /**
20
     * @var bool
21
     */
22
    private $keep;
23
24
    /**
25
     * TokenBuilder constructor.
26
     * @param int $id
27
     * @param string $name
28
     * @param bool $keep
29
     */
30
    public function __construct(int $id, string $name, bool $keep)
31
    {
32
        parent::__construct($id, $name);
33
        $this->keep = $keep;
34
    }
35
36
    /**
37
     * @return Symbol
38
     */
39
    public function build(): Symbol
40
    {
41
        return new Token($this->getId(), $this->getName(), $this->keep);
42
    }
43
}
44