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

PrecisionDetector   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 0%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A detectPrecision() 0 8 1
detectDegreePrecision() 0 1 ?
1
<?php
2
3
declare( strict_types = 1 );
4
5
namespace DataValues\Geo\PackagePrivate;
6
7
use DataValues\Geo\Values\LatLongValue;
8
use DataValues\Geo\Values\Precision;
9
10
abstract class PrecisionDetector {
11
12
	public function detectPrecision( LatLongValue $latLong ): Precision {
13
		return new Precision(
14
			min(
15
				$this->detectDegreePrecision( $latLong->getLatitude() ),
16
				$this->detectDegreePrecision( $latLong->getLongitude() )
17
			)
18
		);
19
	}
20
21
	abstract protected function detectDegreePrecision( float $degree ): float;
22
23
}
24