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

Precision::toFloat()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

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