Completed
Pull Request — master (#80)
by Christoffer
02:18
created

SpreadReader::supportsReader()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
cc 3
eloc 2
nc 3
nop 2
1
<?php
2
3
namespace Digia\GraphQL\Language\Reader;
4
5
use Digia\GraphQL\Language\Token;
6
use Digia\GraphQL\Language\TokenKindEnum;
7
use function Digia\GraphQL\Language\charCodeAt;
8
9
class SpreadReader extends AbstractReader
10
{
11
12
    /**
13
     * @inheritdoc
14
     */
15
    public function read(int $code, int $pos, int $line, int $col, Token $prev): Token
16
    {
17
        return new Token(TokenKindEnum::SPREAD, $pos, $pos + 3, $line, $col, $prev);
18
    }
19
20
    /**
21
     * @inheritdoc
22
     */
23
    public function supportsReader(int $code, int $pos): bool
24
    {
25
        $body = $this->lexer->getBody();
26
27
        return $code === 46 && charCodeAt($body, $pos + 1) === 46 && charCodeAt($body, $pos + 2) === 46; // ...
28
    }
29
}
30