Completed
Pull Request — master (#201)
by Christoffer
02:54
created

DeprecationTrait   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 31
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A isDeprecated() 0 3 1
A setDeprecationReason() 0 4 1
A getDeprecationReason() 0 3 1
1
<?php
2
3
namespace Digia\GraphQL\Type\Definition;
4
5
trait DeprecationTrait
6
{
7
    /**
8
     * @var string|null
9
     */
10
    protected $deprecationReason;
11
12
    /**
13
     * @return null|string
14
     */
15
    public function getDeprecationReason(): ?string
16
    {
17
        return $this->deprecationReason;
18
    }
19
20
    /**
21
     * @return bool
22
     */
23
    public function isDeprecated(): bool
24
    {
25
        return null !== $this->deprecationReason;
26
    }
27
28
    /**
29
     * @param null|string $deprecationReason
30
     * @return $this
31
     */
32
    protected function setDeprecationReason(?string $deprecationReason)
33
    {
34
        $this->deprecationReason = $deprecationReason;
35
        return $this;
36
    }
37
}
38