Directive   A
last analyzed

Complexity

Total Complexity 11

Size/Duplication

Total Lines 127
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 83.33%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 11
c 1
b 0
f 0
lcom 1
cbo 2
dl 0
loc 127
ccs 20
cts 24
cp 0.8333
rs 10

9 Methods

Rating   Name   Duplication   Size   Complexity  
A includeDirective() 0 8 2
A skipDirective() 0 8 2
A getName() 0 4 1
A getDescription() 0 4 1
A getArguments() 0 4 1
A getType() 0 4 1
A onOperation() 0 4 1
A onFragment() 0 4 1
A onField() 0 4 1
1
<?php
2
3
namespace Fubhy\GraphQL\Type\Directives;
4
5
/**
6
 * Directives are used by the GraphQL runtime as a way of modifying execution
7
 * behavior. Type system creators will usually not create these directly.
8
 */
9
abstract class Directive implements DirectiveInterface
10
{
11
    /**
12
     * @var \Fubhy\GraphQL\Type\Directives\DirectiveInterface
13
     */
14
    protected static $include;
15
16
    /**
17
     * @var \Fubhy\GraphQL\Type\Directives\DirectiveInterface
18
     */
19
    protected static $skip;
20
21
    /**
22
     * @var string
23
     */
24
    protected $name;
25
26
    /**
27
     * @var string
28
     */
29
    protected $description;
30
31
    /**
32
     * @var array
33
     */
34
    protected $arguments;
35
36
    /**
37
     * @var \Fubhy\GraphQL\Type\Definition\Types\TypeInterface
38
     */
39
    protected $type;
40
41
    /**
42
     * @var bool
43
     */
44
    protected $onOperation;
45
46
    /**
47
     * @var bool
48
     */
49
    protected $onFragment;
50
51
    /**
52
     * @var bool
53
     */
54
    protected $onField;
55
56
    /**
57
     * @return \Fubhy\GraphQL\Type\Directives\DirectiveInterface
58
     */
59 279
    public static function includeDirective()
60
    {
61 279
        if (!isset(static::$include)) {
62 3
            static::$include = new IncludeDirective();
63 3
        }
64
65 279
        return static::$include;
66
    }
67
68
    /**
69
     * @return \Fubhy\GraphQL\Type\Directives\DirectiveInterface
70
     */
71 279
    public static function skipDirective()
72
    {
73 279
        if (!isset(static::$skip)) {
74 3
            static::$skip = new SkipDirective();
75 3
        }
76
77 279
        return static::$skip;
78
    }
79
80
    /**
81
     * {@inheritdoc}
82
     */
83 15
    public function getName()
84
    {
85 15
        return $this->name;
86
    }
87
88
    /**
89
     * {@inheritdoc}
90
     */
91
    public function getDescription()
92
    {
93
        return $this->description;
94
    }
95
96
    /**
97
     * {@inheritdoc}
98
     */
99 15
    public function getArguments()
100
    {
101 15
        return $this->arguments;
102
    }
103
104
    /**
105
     * {@inheritdoc}
106
     */
107
    public function getType()
108
    {
109
        return $this->type;
110
    }
111
112
    /**
113
     * {@inheritdoc}
114
     */
115 3
    public function onOperation()
116
    {
117 3
        return $this->onOperation;
118
    }
119
120
    /**
121
     * {@inheritdoc}
122
     */
123 3
    public function onFragment()
124
    {
125 3
        return $this->onFragment;
126
    }
127
128
    /**
129
     * {@inheritdoc}
130
     */
131 3
    public function onField()
132
    {
133 3
        return $this->onField;
134
    }
135
}
136