RuntimeConstant   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 80%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 1
dl 0
loc 28
ccs 8
cts 10
cp 0.8
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getName() 0 4 1
A getValue() 0 4 1
A generateCode() 0 4 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