DefaultValueTrait::setDefaultValue()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 7
ccs 4
cts 4
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 1
crap 1
1
<?php declare(strict_types=1);
2
3
namespace Igni\Utils\ReflectionApi;
4
5
trait DefaultValueTrait
6
{
7
    private $defaultValue = null;
8
    private $hasDefaultValue = false;
9
10 1
    public function setDefaultValue($value): self
11
    {
12 1
        $this->defaultValue = $value;
13 1
        $this->hasDefaultValue = true;
14
15 1
        return $this;
16
    }
17
18 3
    public function hasDefaultValue(): bool
19
    {
20 3
        return $this->hasDefaultValue;
21
    }
22
23 1
    public function getDefaultValue()
24
    {
25 1
        return $this->defaultValue;
26
    }
27
}
28