Passed
Push — 4.x ( f9780c...a64886 )
by Doug
05:20
created

Geographic::getSupportedSRIDs()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 0
crap 1
1
<?php
2
/**
3
 * PHPCoord.
4
 *
5
 * @author Doug Wright
6
 */
7
declare(strict_types=1);
8
9
namespace PHPCoord\CoordinateReferenceSystem;
10
11
use function array_merge;
12
use PHPCoord\Exception\UnknownCoordinateReferenceSystemException;
13
14
abstract class Geographic extends CoordinateReferenceSystem
15
{
16 5
    public static function fromSRID(string $srid): self
17
    {
18 5
        if (isset(Geographic2D::getSupportedSRIDs()[$srid])) {
19 3
            return Geographic2D::fromSRID($srid);
20
        }
21
22 2
        if (isset(Geographic3D::getSupportedSRIDs()[$srid])) {
23 1
            return Geographic3D::fromSRID($srid);
24
        }
25
26 1
        throw new UnknownCoordinateReferenceSystemException($srid);
27
    }
28
29 1
    public static function getSupportedSRIDs(): array
30
    {
31 1
        return array_merge(Geographic2D::getSupportedSRIDs(), Geographic3D::getSupportedSRIDs());
32
    }
33
}
34