SingleVariable::setVariableValue()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

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