Passed
Push — master ( fd93b5...48e916 )
by Doug
40:26 queued 29:39
created

NADCON5Grids   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 11
dl 0
loc 20
ccs 10
cts 10
cp 1
rs 10
c 1
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getValues() 0 7 2
A __construct() 0 5 1
1
<?php
2
/**
3
 * PHPCoord.
4
 *
5
 * @author Doug Wright
6
 */
7
declare(strict_types=1);
8
9
namespace PHPCoord\CoordinateOperation;
10
11
use PHPCoord\UnitOfMeasure\Angle\ArcSecond;
12
use PHPCoord\UnitOfMeasure\Length\Metre;
13
14
class NADCON5Grids extends GeographicGrid
15
{
16
    private NADCON5Grid $longitudeGrid;
17
    private NADCON5Grid $latitudeGrid;
18
    private ?NADCON5Grid $ellipsoidHeightGrid;
19
20 7
    public function __construct(NADCON5Grid $longitudeGrid, NADCON5Grid $latitudeGrid, ?NADCON5Grid $ellipsoidHeightGrid)
21
    {
22 7
        $this->longitudeGrid = $longitudeGrid;
23 7
        $this->latitudeGrid = $latitudeGrid;
24 7
        $this->ellipsoidHeightGrid = $ellipsoidHeightGrid;
25 7
    }
26
27 7
    public function getValues(float $x, float $y): array
28
    {
29 7
        $latitudeShift = new ArcSecond($this->latitudeGrid->getValues($x, $y)[0]);
30 7
        $longitudeShift = new ArcSecond($this->longitudeGrid->getValues($x, $y)[0]);
31 7
        $heightShift = $this->ellipsoidHeightGrid ? new Metre($this->ellipsoidHeightGrid->getValues($x, $y)[0]) : null;
32
33 7
        return [$latitudeShift, $longitudeShift, $heightShift];
34
    }
35
}
36