Completed
Pull Request — master (#20)
by Christoffer
02:40 queued 53s
created

TypesTrait   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 24
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getTypes() 0 3 1
A getTypesAsArray() 0 5 1
1
<?php
2
3
namespace Digia\GraphQL\Language\AST\Node;
4
5
use Digia\GraphQL\SerializationInterface;
6
7
trait TypesTrait
8
{
9
10
    /**
11
     * @var NamedTypeNode[]
12
     */
13
    protected $types;
14
15
    /**
16
     * @return NamedTypeNode[]
17
     */
18
    public function getTypes(): array
19
    {
20
        return $this->types;
21
    }
22
23
    /**
24
     * @return array
25
     */
26
    public function getTypesAsArray(): array
27
    {
28
        return array_map(function (SerializationInterface $node) {
29
            return $node->toArray();
30
        }, $this->types);
31
    }
32
}
33