MatchRepeat   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
eloc 6
c 1
b 0
f 0
dl 0
loc 46
ccs 10
cts 10
cp 1
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getToken() 0 3 1
A getLexeme() 0 3 1
A shouldRepeat() 0 3 1
A hasToken() 0 3 1
A hasLexeme() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Remorhaz\Lexer\Runtime\Token;
6
7
use Remorhaz\Lexer\Runtime\IO\LexemeInterface;
8
9
/**
10
 * @psalm-immutable
11
 */
12
final class MatchRepeat implements MatchResultInterface
13
{
14
15
    /**
16
     * @return bool
17
     * @psalm-pure
18
     */
19 1
    public function shouldRepeat(): bool
20
    {
21 1
        return true;
22
    }
23
24
    /**
25
     * @return bool
26
     * @psalm-pure
27
     */
28 1
    public function hasToken(): bool
29
    {
30 1
        return false;
31
    }
32
33
    /**
34
     * @return TokenInterface
35
     * @psalm-pure
36
     */
37 1
    public function getToken(): TokenInterface
38
    {
39 1
        throw new Exception\TokenNotReadyException();
40
    }
41
42
    /**
43
     * @return bool
44
     * @psalm-pure
45
     */
46 1
    public function hasLexeme(): bool
47
    {
48 1
        return false;
49
    }
50
51
    /**
52
     * @return LexemeInterface
53
     * @psalm-pure
54
     */
55 1
    public function getLexeme(): LexemeInterface
56
    {
57 1
        throw new Exception\TokenNotReadyException();
58
    }
59
}
60