Completed
Push — master ( 8085b1...79cabf )
by David
17s
created

AbstractRequest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 7
dl 0
loc 41
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getName() 0 3 1
A __construct() 0 4 1
A getOutputType() 0 3 1
1
<?php
2
3
4
namespace TheCodingMachine\GraphQL\Controllers\Annotations;
5
6
7
abstract class AbstractRequest
8
{
9
    /**
10
     * @var string|null
11
     */
12
    private $outputType;
13
14
    /**
15
     * @var string|null
16
     */
17
    private $name;
18
19
    /**
20
     * @param mixed[] $attributes
21
     */
22
    public function __construct(array $attributes = [])
23
    {
24
        $this->outputType = $attributes['outputType'] ?? null;
25
        $this->name = $attributes['name'] ?? null;
26
    }
27
28
    /**
29
     * Returns the GraphQL return type of the request (as a string).
30
     * The string can represent the FQCN of the type or an entry in the container resolving to the GraphQL type.
31
     *
32
     * @return string|null
33
     */
34
    public function getOutputType(): ?string
35
    {
36
        return $this->outputType;
37
    }
38
39
    /**
40
     * Returns the name of the GraphQL query/mutation/field.
41
     * If not specified, the name of the method should be used instead.
42
     *
43
     * @return null|string
44
     */
45
    public function getName(): ?string
46
    {
47
        return $this->name;
48
    }
49
}
50