Passed
Pull Request — master (#145)
by Christoffer
03:59 queued 01:32
created

DescriptionASTBuilder::supportsBuilder()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
eloc 1
nc 1
nop 1
1
<?php
2
3
namespace Digia\GraphQL\Language\ASTBuilder;
4
5
use Digia\GraphQL\Language\LexerInterface;
6
7
class DescriptionASTBuilder extends AbstractASTBuilder
8
{
9
    /**
10
     * @inheritdoc
11
     */
12
    public function supportsBuilder(string $kind): bool
13
    {
14
        return $kind === ASTKindEnum::DESCRIPTION;
15
    }
16
17
    /**
18
     * @inheritdoc
19
     */
20
    public function build(LexerInterface $lexer, array $params): ?array
21
    {
22
        return $this->peekDescription($lexer)
23
            ? $this->buildAST(ASTKindEnum::STRING_LITERAL, $lexer)
24
            : null;
25
    }
26
}
27