Completed
Pull Request — master (#2)
by Adrien
02:16
created

Argument::toArray()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 14
Code Lines 8

Duplication

Lines 14
Ratio 100 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
dl 14
loc 14
ccs 0
cts 12
cp 0
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 8
nc 2
nop 0
crap 6
1
<?php
2
3
declare(strict_types=1);
4
5
namespace GraphQL\Doctrine\Annotation;
6
7
use GraphQL\Type\Definition\Type;
8
9
/**
10
 * Annotation used to override values for an field argument in GraphQL.
11
 *
12
 * All values are optional and should only be used to override
13
 * what is declared by the original argument of the method.
14
 *
15
 * @Annotation
16
 * @Target({"ANNOTATION"})
17
 */
18
class Argument
19
{
20
    /**
21
     * The name of the argument, it must matches the actual PHP argument name
22
     *
23
     * @var string
24
     * @Required
25
     */
26
    public $name;
27
28
    /**
29
     * FQCN of PHP class implementing the GraphQL type
30
     *
31
     * @var string
32
     */
33
    public $type;
34
35
    /**
36
     * @var string
37
     */
38
    public $description;
39
40
    /**
41
     * @var mixed
42
     */
43
    public $defaultValue;
44
45 View Code Duplication
    public function toArray(): array
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
46
    {
47
        $data = [
48
            'name' => $this->name,
49
            'type' => $this->type,
50
            'description' => $this->description,
51
        ];
52
53
        if ($this->defaultValue !== null) {
54
            $data['defaultValue'] = $this->defaultValue;
55
        }
56
57
        return $data;
58
    }
59
}
60