Passed
Pull Request — master (#63)
by David
01:54
created

Factory::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
4
namespace TheCodingMachine\GraphQL\Controllers\Annotations;
5
6
/**
7
 * Factories are methods used to declare GraphQL input types.
8
 *
9
 * @Annotation
10
 * @Target({"METHOD"})
11
 * @Attributes({
12
 *   @Attribute("name", type = "string")
13
 * })
14
 */
15
class Factory
16
{
17
    /**
18
     * @var string|null
19
     */
20
    private $name;
21
22
    /**
23
     * @param mixed[] $attributes
24
     */
25
    public function __construct(array $attributes = [])
26
    {
27
        $this->name = $attributes['name'] ?? null;
28
    }
29
30
    /**
31
     * Returns the name of the GraphQL input type.
32
     * If not specified, the name of the method should be used instead.
33
     *
34
     * @return null|string
35
     */
36
    public function getName(): ?string
37
    {
38
        return $this->name;
39
    }
40
}
41