RuntimeConstant::generateCode()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php declare(strict_types=1);
2
3
namespace Igni\Utils\ReflectionApi;
4
5
class RuntimeConstant implements CodeGenerator
6
{
7
    use VisibilityTrait;
8
9
    private $name;
10
    private $value;
11
12 1
    public function __construct(string $name, $value)
13
    {
14 1
        $this->name = $name;
15 1
        $this->value = $value;
16 1
    }
17
18 1
    public function getName(): string
19
    {
20 1
        return $this->name;
21
    }
22
23
    public function getValue()
24
    {
25
        return $this->value;
26
    }
27
28 1
    public function generateCode(): string
29
    {
30 1
        return "{$this->visibility} const {$this->name} = " . var_export($this->value, true) . ';';
31
    }
32
}
33