Failed Conditions
Push — master ( a4f39b...12ee90 )
by Vladimir
11:17
created

ASTValidationContext::getSchema()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace GraphQL\Validator;
6
7
use GraphQL\Error\Error;
8
use GraphQL\Language\AST\DocumentNode;
9
use GraphQL\Type\Schema;
10
11
abstract class ASTValidationContext
12
{
13
    /** @var DocumentNode */
14
    protected $ast;
15
16
    /** @var Error[] */
17
    protected $errors;
18
19
    /** @var Schema */
20
    protected $schema;
21
22 724
    public function __construct(DocumentNode $ast, ?Schema $schema = null)
23
    {
24 724
        $this->ast    = $ast;
25 724
        $this->schema = $schema;
26 724
        $this->errors = [];
27 724
    }
28
29 223
    public function reportError(Error $error)
30
    {
31 223
        $this->errors[] = $error;
32 223
    }
33
34
    /**
35
     * @return Error[]
36
     */
37 724
    public function getErrors()
38
    {
39 724
        return $this->errors;
40
    }
41
42
    /**
43
     * @return DocumentNode
44
     */
45 441
    public function getDocument()
46
    {
47 441
        return $this->ast;
48
    }
49
50 424
    public function getSchema() : ?Schema
51
    {
52 424
        return $this->schema;
53
    }
54
}
55