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

FloatPrecisionDetector   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 13
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A detectDegreePrecision() 0 9 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