Completed
Pull Request — master (#168)
by Jeroen De
03:33 queued 45s
created

FloatPrecisionDetector   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

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

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
	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