Passed
Pull Request — master (#159)
by Christoffer
03:39
created

SupportedRules::build()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 9
rs 9.6666
c 0
b 0
f 0
cc 2
eloc 4
nc 2
nop 0
1
<?php
2
3
namespace Digia\GraphQL\SchemaValidation\Rule;
4
5
use Digia\GraphQL\GraphQL;
6
7
class SupportedRules
8
{
9
    /**
10
     * @var array
11
     */
12
    private static $supportedRules = [
13
        RootTypesRule::class,
14
        DirectivesRule::class,
15
        TypesRule::class,
16
    ];
17
18
    /**
19
     * Rules maintain state so they should always be re-instantiated.
20
     *
21
     * @return RuleInterface[]
22
     */
23
    public static function build(): array
24
    {
25
        $rules = [];
26
27
        foreach (self::$supportedRules as $className) {
28
            $rules[] = GraphQL::make($className);
29
        }
30
31
        return $rules;
32
    }
33
}
34