SingleVariable   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
eloc 11
c 1
b 0
f 0
dl 0
loc 31
ccs 13
cts 13
cp 1
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A setVariableName() 0 4 1
A getVariableValue() 0 3 1
A setVariableValue() 0 4 1
A getVariableName() 0 3 1
A __construct() 0 3 1
1
<?php
2
3
namespace kalanis\kw_address_handler;
4
5
6
/**
7
 * Class SingleVariable
8
 * @package kalanis\kw_address_handler
9
 * Process single defined parameter in address inside the params
10
 */
11
class SingleVariable
12
{
13
    protected Params $params;
14
    protected string $variableValue = '';
15
    protected string $variableName = 'variable';
16
17 6
    public function __construct(Params $params)
18
    {
19 6
        $this->params = $params;
20 6
    }
21
22 6
    public function setVariableName(string $name): self
23
    {
24 6
        $this->variableName = $name;
25 6
        return $this;
26
    }
27
28 1
    public function getVariableName(): string
29
    {
30 1
        return $this->variableName;
31
    }
32
33 6
    public function setVariableValue(string $value): self
34
    {
35 6
        $this->params->offsetSet($this->variableName, $value);
36 6
        return $this;
37
    }
38
39 5
    public function getVariableValue(): string
40
    {
41 5
        return strval($this->params->offsetGet($this->variableName));
42
    }
43
}
44