Passed
Push — 4.x ( e9b635...bc20e1 )
by Doug
07:44
created

Fathom   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 6
c 1
b 0
f 0
dl 0
loc 22
ccs 9
cts 9
cp 1
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A asMetres() 0 3 1
A getUnitName() 0 3 1
A __construct() 0 3 1
A getValue() 0 3 1
1
<?php
2
/**
3
 * PHPCoord.
4
 *
5
 * @author Doug Wright
6
 */
7
declare(strict_types=1);
8
9
namespace PHPCoord\UnitOfMeasure\Length;
10
11
class Fathom extends Length
12
{
13
    private float $length;
14
15 9
    public function __construct(float $length)
16
    {
17 9
        $this->length = $length;
18 9
    }
19
20 3
    public function asMetres(): Metre
21
    {
22 3
        return new Metre($this->length * 1.8288);
23
    }
24
25 5
    public function getValue(): float
26
    {
27 5
        return $this->length;
28
    }
29
30 1
    public function getUnitName(): string
31
    {
32 1
        return 'fathom';
33
    }
34
}
35