Completed
Push — master ( 3aac06...366db0 )
by Adrien
01:53
created

Input::toArray()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 14
Code Lines 8

Duplication

Lines 14
Ratio 100 %

Code Coverage

Tests 7
CRAP Score 2

Importance

Changes 0
Metric Value
dl 14
loc 14
ccs 7
cts 7
cp 1
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 8
nc 2
nop 0
crap 2
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 input field in GraphQL.
11
 *
12
 * All values are optional and should only be used to override
13
 * what is declared by the original method.
14
 *
15
 * @Annotation
16
 * @Target({"METHOD"})
17
 */
18
class Input
19
{
20
    /**
21
     * @var string
22
     */
23
    public $name;
24
25
    /**
26
     * FQCN of PHP class implementing the GraphQL type
27
     *
28
     * @var string
29
     */
30
    public $type;
31
32
    /**
33
     * @var string
34
     */
35
    public $description;
36
37
    /**
38
     * @var mixed
39
     */
40
    public $defaultValue;
41
42 1 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...
43
    {
44
        $data = [
45 1
            'name' => $this->name,
46 1
            'type' => $this->type,
47 1
            'description' => $this->description,
48
        ];
49
50 1
        if ($this->defaultValue !== null) {
51 1
            $data['defaultValue'] = $this->defaultValue;
52
        }
53
54 1
        return $data;
55
    }
56
}
57