Passed
Push — GlobeCoordinateParser ( aed06a...a4aa24 )
by Jeroen De
02:14
created

Precision   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 0
dl 0
loc 17
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 3
A toFloat() 0 3 1
1
<?php
2
3
declare( strict_types = 1 );
4
5
namespace DataValues\Geo\PackagePrivate;
6
7
class Precision {
8
9
	private $precision;
10
11 10
	public function __construct( float $precisionInDegrees ) {
12 10
		if ( $precisionInDegrees < -360 || $precisionInDegrees > 360 ) {
13 2
			throw new \InvalidArgumentException( '$precision needs to be between -360 and 360' );
14
		}
15
16 8
		$this->precision = $precisionInDegrees;
17 8
	}
18
19 8
	public function toFloat(): float {
20 8
		return $this->precision;
21
	}
22
23
}
24