Production::getHeaderId()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Remorhaz\UniLex\Grammar\ContextFree;
6
7
class Production
8
{
9
    private $headerId;
10
11
    private $index;
12
13
    private $symbolList;
14
15
    public function __construct(int $headerId, int $index, int ...$symbolList)
16
    {
17
        $this->headerId = $headerId;
18
        $this->index = $index;
19
        $this->symbolList = $symbolList;
20
    }
21
22
    public function __toString()
23
    {
24
        return "{$this->getHeaderId()}:{$this->getIndex()}";
25
    }
26
27
    public function getHeaderId(): int
28
    {
29
        return $this->headerId;
30
    }
31
32
    public function getIndex(): int
33
    {
34
        return $this->index;
35
    }
36
37
    /**
38
     * @return int[]
39
     */
40
    public function getSymbolList(): array
41
    {
42
        return $this->symbolList;
43
    }
44
45
    public function isEpsilon(): bool
46
    {
47
        return empty($this->getSymbolList());
48
    }
49
}
50