Completed
Push — master ( 96b2f8...da2c9c )
by Kirill
05:58
created

HasDeprecation   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 0
dl 0
loc 31
ccs 0
cts 12
cp 0
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A isDeprecated() 0 4 1
A setDeprecationReason() 0 4 1
A getDeprecationReason() 0 4 1
1
<?php
2
/**
3
 * This file is part of Railt package.
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 */
8
declare(strict_types=1);
9
10
namespace Railt\Reflection\Definition\Behaviour;
11
12
use Railt\Reflection\Contracts\Definition\Behaviour\Deprecatable;
13
14
/**
15
 * Trait HasDeprecation
16
 * @mixin Deprecatable
17
 */
18
trait HasDeprecation
19
{
20
    /**
21
     * @var string|null
22
     */
23
    protected $deprecation;
24
25
    /**
26
     * @return bool
27
     */
28
    public function isDeprecated(): bool
29
    {
30
        return $this->deprecation !== null;
31
    }
32
33
    /**
34
     * @param null|string $reason
35
     */
36
    public function setDeprecationReason(?string $reason): void
37
    {
38
        $this->deprecation = $reason;
39
    }
40
41
    /**
42
     * @return string
43
     */
44
    public function getDeprecationReason(): string
45
    {
46
        return (string)$this->deprecation;
47
    }
48
}
49