Completed
Push — master ( b0b79e...9ac4d8 )
by Hans
18s
created

ScannerTokens   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 1
dl 0
loc 50
ccs 13
cts 13
cp 1
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getLastToken() 0 4 1
A peek() 0 4 1
A next() 0 4 1
A eof() 0 4 1
A back() 0 4 1
1
<?php
2
3
namespace HansOtt\GraphQL\Shared;
4
5
final class ScannerTokens implements Scanner
6
{
7
    private $scanner;
8
    private $lastToken;
9
10 78
    public function __construct(Scanner $scanner)
11
    {
12 78
        $this->scanner = $scanner;
13 78
    }
14
15 24
    public function getLastToken()
16
    {
17 24
        return $this->lastToken;
18
    }
19
20
    /**
21
     * @throws ScannerReachedEnd
22
     *
23
     * @return Token
24
     */
25 75
    public function peek()
26
    {
27 75
        return $this->scanner->peek();
28
    }
29
30
    /**
31
     * @throws ScannerReachedEnd
32
     *
33
     * @return Token
34
     */
35 75
    public function next()
36
    {
37 75
        return $this->lastToken = $this->scanner->next();
38
    }
39
40 78
    public function eof()
41
    {
42 78
        return $this->scanner->eof();
43
    }
44
45
    /**
46
     * @throws ScannerReachedEnd
47
     *
48
     * @return Token
49
     */
50 3
    public function back()
51
    {
52 3
        return $this->lastToken = $this->scanner->back();
53
    }
54
}
55