Passed
Push — GlobeCoordinateParser ( 7d8c3a )
by Jeroen De
02:26
created

FloatPrecisionDetector::detectDegreePrecision()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
dl 0
loc 9
c 0
b 0
f 0
ccs 0
cts 5
cp 0
rs 9.9666
cc 2
nc 2
nop 1
crap 6
1
<?php
2
3
declare( strict_types = 1 );
4
5
namespace DataValues\Geo\PackagePrivate;
6
7
class FloatPrecisionDetector extends PrecisionDetector {
8
9
	public function detectDegreePrecision( float $degree ): float {
10
		$split = explode( '.', (string)round( $degree, 8 ) );
11
12
		if ( isset( $split[1] ) ) {
13
			return pow( 10, -strlen( $split[1] ) );
14
		}
15
16
		return 1;
17
	}
18
19
}
20