Passed
Pull Request — master (#20)
by Christoffer
02:08
created

InputFieldsTrait::getFields()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Digia\GraphQL\Language\AST\Node;
4
5
use Digia\GraphQL\SerializationInterface;
6
7
trait InputFieldsTrait
8
{
9
10
    /**
11
     * @var InputValueDefinitionNode[]
12
     */
13
    protected $fields;
14
15
    /**
16
     * @return InputValueDefinitionNode[]
17
     */
18
    public function getFields(): array
19
    {
20
        return $this->fields;
21
    }
22
23
    /**
24
     * @return array
25
     */
26
    public function getFieldsAsArray(): array
27
    {
28
        return array_map(function (SerializationInterface $node) {
29
            return $node->toArray();
30
        }, $this->fields);
31
    }
32
}
33