Completed
Pull Request — master (#168)
by Jeroen De
02:05
created

FloatPrecisionDetector::detectDegreePrecision()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

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