Completed
Pull Request — master (#70)
by Christoffer
02:06
created

DescriptionTrait::setDescription()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace Digia\GraphQL\Language\Node;
4
5
trait DescriptionTrait
6
{
7
8
    /**
9
     * @var StringValueNode|null
10
     */
11
    protected $description;
12
13
    /**
14
     * @return StringValueNode|null
15
     */
16
    public function getDescription(): ?StringValueNode
17
    {
18
        return $this->description;
19
    }
20
21
    /**
22
     * @return null|string
23
     */
24
    public function getDescriptionValue(): ?string
25
    {
26
        return null !== $this->description ? $this->description->getValue() : null;
27
    }
28
29
    /**
30
     * @return array|null
31
     */
32
    public function getDescriptionAsArray(): ?array
33
    {
34
        return null !== $this->description ? $this->description->toArray() : null;
35
    }
36
37
    /**
38
     * @param StringValueNode|null $description
39
     * @return $this
40
     */
41
    public function setDescription(?StringValueNode $description)
42
    {
43
        $this->description = $description;
44
        return $this;
45
    }
46
}
47