Completed
Pull Request — master (#45)
by Christoffer
02:18
created

SupportedWriters   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 49
rs 10
c 0
b 0
f 0
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A get() 0 9 3
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