FloatType   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 6
cbo 0
dl 0
loc 36
ccs 14
cts 14
cp 1
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A get() 0 4 1
A set() 0 4 1
A containsStringCount() 0 4 1
A replaceString() 0 4 1
A __toString() 0 4 1
1
<?php declare(strict_types=1);
2
3
/**
4
 * @copyright   (c) 2019-present brian ridley
5
 * @author      brian ridley <[email protected]>
6
 * @license     http://opensource.org/licenses/MIT MIT
7
 */
8
9
namespace ptlis\SerializedDataEditor\Type;
10
11
use ptlis\SerializedDataEditor\Parser\Token;
12
13
/**
14
 * Class representing a serialized float value.
15
 */
16
final class FloatType implements Type
17
{
18
    /** @var float */
19
    private $value;
20
21
22 11
    public function __construct(float $value)
23
    {
24 11
        $this->value = $value;
25 11
    }
26
27 2
    public function get(): float
28
    {
29 2
        return $this->value;
30
    }
31
32 1
    public function set(float $value): void
33
    {
34 1
        $this->value = $value;
35 1
    }
36
37 4
    public function containsStringCount(string $searchTerm): int
38
    {
39 4
        return 0;
40
    }
41
42 3
    public function replaceString(string $searchTerm, string $replaceTerm): void
43
    {
44
        // Do nothing
45 3
    }
46
47 2
    public function __toString(): string
48
    {
49 2
        return Token::PREFIX_FLOAT . ':' . $this->value . ';';
50
    }
51
}