Completed
Pull Request — master (#118)
by Christoffer
03:28 queued 01:13
created

SupportedRules::build()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

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