Completed
Pull Request — master (#51)
by Christoffer
02:05
created

SupportedWriters::get()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
eloc 4
nc 2
nop 0
dl 0
loc 9
rs 9.6666
c 0
b 0
f 0
1
<?php
2
3
namespace Digia\GraphQL\Language\Writer;
4
5
class SupportedWriters
6
{
7
    /**
8
     * @var WriterInterface[]
9
     */
10
    private static $writers;
11
12
    /**
13
     * @var array
14
     */
15
    private static $supportedWriters = [
16
        ArgumentWriter::class,
17
        BooleanValueWriter::class,
18
        DirectiveWriter::class,
19
        DocumentWriter::class,
20
        EnumValueWriter::class,
21
        FieldWriter::class,
22
        FloatValueWriter::class,
23
        FragmentDefinitionWriter::class,
24
        FragmentSpreadWriter::class,
25
        InlineFragmentWriter::class,
26
        IntValueWriter::class,
27
        ListTypeWriter::class,
28
        ListValueWriter::class,
29
        NamedTypeWriter::class,
30
        NameWriter::class,
31
        NullTypeWriter::class,
32
        ObjectFieldWriter::class,
33
        ObjectValueWriter::class,
34
        OperationDefinitionWriter::class,
35
        SelectionSetWriter::class,
36
        StringValueWriter::class,
37
        VariableDefinitionWriter::class,
38
        VariableWriter::class,
39
        // TODO: Add support for printing Type System Definitions (SDL).
40
    ];
41
42
    /**
43
     * @return array
44
     */
45
    public static function get(): array
46
    {
47
        if (null === self::$writers) {
0 ignored issues
show
introduced by
The condition null === self::writers is always false.
Loading history...
48
            foreach (self::$supportedWriters as $className) {
49
                self::$writers[] = new $className();
50
            }
51
        }
52
53
        return self::$writers;
54
    }
55
}
56