Passed
Push — master ( e7bef7...3228c5 )
by Vladimir
03:06
created

LexerBench   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 7
dl 0
loc 21
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 3 1
A benchIntrospectionQuery() 0 7 2
1
<?php
2
namespace GraphQL\Benchmarks;
3
4
use GraphQL\Language\Lexer;
5
use GraphQL\Language\Source;
6
use GraphQL\Language\Token;
7
use GraphQL\Type\Introspection;
8
9
/**
10
 * @BeforeMethods({"setUp"})
11
 * @OutputTimeUnit("milliseconds", precision=3)
12
 */
13
class LexerBench
14
{
15
    private $introQuery;
16
17
    public function setUp()
18
    {
19
        $this->introQuery = new Source(Introspection::getIntrospectionQuery());
20
    }
21
22
    /**
23
     * @Warmup(2)
24
     * @Revs(100)
25
     * @Iterations(5)
26
     */
27
    public function benchIntrospectionQuery()
28
    {
29
        $lexer = new Lexer($this->introQuery);
30
31
        do {
32
            $token = $lexer->advance();
33
        } while ($token->kind !== Token::EOF);
34
    }
35
}
36