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

DmsPrecisionDetector   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
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 14
c 0
b 0
f 0
ccs 0
cts 6
cp 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A detectDegreePrecision() 0 10 2
1
<?php
2
3
declare( strict_types = 1 );
4
5
namespace DataValues\Geo\PackagePrivate;
6
7
class DmsPrecisionDetector extends PrecisionDetector {
8
9
	public function detectDegreePrecision( float $degree ): float {
10
		$seconds = $degree * 3600;
11
		$split = explode( '.', (string)round( $seconds, 4 ) );
12
13
		if ( isset( $split[1] ) ) {
14
			return pow( 10, -strlen( $split[1] ) ) / 3600;
15
		}
16
17
		return 1 / 3600;
18
	}
19
20
}
21