GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Push — master ( e7bef7...3cccd4 )
by Šimon
03:07
created

HugeSchemaBench::setUp()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 13
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
namespace GraphQL\Benchmarks;
3
4
use GraphQL\Benchmarks\Utils\QueryGenerator;
5
use GraphQL\Benchmarks\Utils\SchemaGenerator;
6
use GraphQL\GraphQL;
7
use GraphQL\Type\Schema;
8
use GraphQL\Type\SchemaConfig;
9
10
/**
11
 * @BeforeMethods({"setUp"})
12
 * @OutputTimeUnit("milliseconds", precision=3)
13
 * @Warmup(1)
14
 * @Revs(5)
15
 * @Iterations(1)
16
 */
17
class HugeSchemaBench
18
{
19
    /** @var SchemaGenerator */
20
    private $schemaBuilder;
21
22
    private $schema;
23
24
    /** @var string */
25
    private $smallQuery;
26
27
    public function setUp()
28
    {
29
        $this->schemaBuilder = new SchemaGenerator([
30
            'totalTypes' => 600,
31
            'fieldsPerType' => 8,
32
            'listFieldsPerType' => 2,
33
            'nestingLevel' => 10,
34
        ]);
35
36
        $this->schema = $this->schemaBuilder->buildSchema();
37
38
        $queryBuilder     = new QueryGenerator($this->schema, 0.05);
39
        $this->smallQuery = $queryBuilder->buildQuery();
40
    }
41
42
    public function benchSchema()
43
    {
44
        $this->schemaBuilder
45
            ->buildSchema()
46
            ->getTypeMap();
47
    }
48
49
    public function benchSchemaLazy()
50
    {
51
        $this->createLazySchema();
52
    }
53
54
    public function benchSmallQuery()
55
    {
56
        $result = GraphQL::executeQuery($this->schema, $this->smallQuery);
0 ignored issues
show
Unused Code introduced by
The assignment to $result is dead and can be removed.
Loading history...
57
    }
58
59
    public function benchSmallQueryLazy()
60
    {
61
        $schema = $this->createLazySchema();
62
        $result = GraphQL::executeQuery($schema, $this->smallQuery);
0 ignored issues
show
Unused Code introduced by
The assignment to $result is dead and can be removed.
Loading history...
63
    }
64
65
    private function createLazySchema()
66
    {
67
        return new Schema(
68
            SchemaConfig::create()
69
                ->setQuery($this->schemaBuilder->buildQueryType())
70
                ->setTypeLoader(function ($name) {
71
                    return $this->schemaBuilder->loadType($name);
72
                })
73
        );
74
    }
75
}
76