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

DmPrecisionDetector   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 2
dl 0
loc 20
c 0
b 0
f 0
ccs 0
cts 9
cp 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A detectDegreePrecision() 0 10 2
1
<?php
2
3
declare( strict_types = 1 );
4
5
namespace DataValues\Geo\PackagePrivate;
6
7
class DmPrecisionDetector extends PrecisionDetector {
8
9
	private $dmsPrecisionDetector;
10
11
	public function __construct() {
12
		$this->dmsPrecisionDetector = new DmsPrecisionDetector();
13
	}
14
15
	public function detectDegreePrecision( float $degree ): float {
16
		$minutes = $degree * 60;
17
		$split = explode( '.', (string)round( $minutes, 6 ) );
18
19
		if ( isset( $split[1] ) ) {
20
			return $this->dmsPrecisionDetector->detectDegreePrecision( $degree );
21
		}
22
23
		return 1 / 60;
24
	}
25
26
}
27