Production   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 12
dl 0
loc 41
rs 10
c 2
b 0
f 0
wmc 6

6 Methods

Rating   Name   Duplication   Size   Complexity  
A isEpsilon() 0 3 1
A getIndex() 0 3 1
A getSymbolList() 0 3 1
A __construct() 0 5 1
A getHeaderId() 0 3 1
A __toString() 0 3 1
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