ValidationRule::getSDLVisitor()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
ccs 0
cts 2
cp 0
rs 10
cc 1
nc 1
nop 1
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace GraphQL\Validator\Rules;
6
7
use GraphQL\Validator\SDLValidationContext;
8
use GraphQL\Validator\ValidationContext;
9
use function class_alias;
10
11
abstract class ValidationRule
12
{
13
    /** @var string */
14
    protected $name;
15
16
    public function getName()
17
    {
18
        return $this->name ?: static::class;
19
    }
20
21
    public function __invoke(ValidationContext $context)
22
    {
23
        return $this->getVisitor($context);
24
    }
25
26
    /**
27
     * Returns structure suitable for GraphQL\Language\Visitor
28
     *
29
     * @see \GraphQL\Language\Visitor
30
     *
31
     * @return mixed[]
32
     */
33
    public function getVisitor(ValidationContext $context)
34
    {
35
        return [];
36
    }
37
38
    /**
39
     * Returns structure suitable for GraphQL\Language\Visitor
40
     *
41
     * @see \GraphQL\Language\Visitor
42
     *
43
     * @return mixed[]
44
     */
45
    public function getSDLVisitor(SDLValidationContext $context)
46
    {
47
        return [];
48
    }
49
}
50
51
class_alias(ValidationRule::class, 'GraphQL\Validator\Rules\AbstractValidationRule');
52