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

HasDeprecation::getDeprecationReason()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 2
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