DeprecateTrait   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Test Coverage

Coverage 71.43%

Importance

Changes 0
Metric Value
wmc 3
eloc 6
dl 0
loc 33
c 0
b 0
f 0
ccs 5
cts 7
cp 0.7143
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getDeprecationReason() 0 3 1
A isDeprecated() 0 3 1
A setDeprecationReason() 0 5 1
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