Completed
Pull Request — master (#46)
by Sam
02:54
created

DeprecationTrait::setIsDeprecated()   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 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Digia\GraphQL\Type\Definition;
4
5
trait DeprecationTrait
6
{
7
8
    /**
9
     * @var ?string
10
     */
0 ignored issues
show
Documentation Bug introduced by
The doc comment ?string at position 0 could not be parsed: Unknown type name '?string' at position 0 in ?string.
Loading history...
11
    private $deprecationReason;
12
13
    /**
14
     * @var bool
15
     */
16
    private $isDeprecated = false;
17
18
    /**
19
     * @return null|string
20
     */
21
    public function getDeprecationReason(): ?string
22
    {
23
        return $this->deprecationReason;
24
    }
25
26
    /**
27
     * @return bool
28
     */
29
    public function isDeprecated(): bool
30
    {
31
        return $this->isDeprecated;
32
    }
33
34
    /**
35
     * @param null|string $deprecationReason
36
     * @return $this
37
     */
38
    protected function setDeprecationReason(?string $deprecationReason)
39
    {
40
        if ($deprecationReason) {
41
            $this->isDeprecated = true;
42
        }
43
44
        $this->deprecationReason = $deprecationReason;
45
46
        return $this;
47
    }
48
}
49