Passed
Push — 4.x ( bd875a...fa991c )
by Doug
17:17 queued 12:22
created

Unity   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Test Coverage

Coverage 84.62%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 6
eloc 8
c 1
b 0
f 0
dl 0
loc 33
ccs 11
cts 13
cp 0.8462
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A getValue() 0 3 1
A getFormattedValue() 0 3 1
A __construct() 0 3 1
A asUnity() 0 3 1
A getUnitName() 0 3 1
A __toString() 0 3 1
1
<?php
2
/**
3
 * PHPCoord.
4
 *
5
 * @author Doug Wright
6
 */
7
declare(strict_types=1);
8
9
namespace PHPCoord\UnitOfMeasure\Scale;
10
11
class Unity implements Scale
12
{
13
    /** @var float */
14
    private $scale;
15
16 7
    public function __construct(float $scale)
17
    {
18 7
        $this->scale = $scale;
19 7
    }
20
21 1
    public function asUnity(): self
22
    {
23 1
        return $this;
24
    }
25
26 3
    public function getValue(): float
27
    {
28 3
        return $this->scale;
29
    }
30
31 1
    public function getFormattedValue(): string
32
    {
33 1
        return (string) $this->scale;
34
    }
35
36 1
    public function getUnitName(): string
37
    {
38 1
        return '';
39
    }
40
41
    public function __toString(): string
42
    {
43
        return (string) $this->getValue();
44
    }
45
}
46