DeprecateTrait::getDeprecationReason()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
/*******************************************************************************
3
 *  This file is part of the GraphQL Bundle package.
4
 *
5
 *  (c) YnloUltratech <[email protected]>
6
 *
7
 *  For the full copyright and license information, please view the LICENSE
8
 *  file that was distributed with this source code.
9
 ******************************************************************************/
10
11
namespace Ynlo\GraphQLBundle\Definition\Traits;
12
13
use Ynlo\GraphQLBundle\Definition\DeprecateInterface;
14
15
/**
16
 * Trait DeprecateTrait
17
 */
18
trait DeprecateTrait
19
{
20
    /**
21
     * @var string
22
     */
23
    protected $deprecationReason;
24
25
    /**
26
     * @param string $deprecationReason
27
     *
28
     * @return DeprecateInterface
29
     */
30 33
    public function setDeprecationReason(?string $deprecationReason): DeprecateInterface
31
    {
32 33
        $this->deprecationReason = $deprecationReason;
33
34 33
        return $this;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this returns the type Ynlo\GraphQLBundle\Defin...n\Traits\DeprecateTrait which is incompatible with the type-hinted return Ynlo\GraphQLBundle\Definition\DeprecateInterface.
Loading history...
35
    }
36
37
    /**
38
     * @return bool
39
     */
40
    public function isDeprecated(): bool
41
    {
42
        return (bool) $this->getDeprecationReason();
43
    }
44
45
    /**
46
     * @return string
47
     */
48 2
    public function getDeprecationReason():?string
49
    {
50 2
        return $this->deprecationReason;
51
    }
52
}
53