ShapeType::name()   A
last analyzed

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 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace PhpMyAdmin\ShapeFile;
6
7
enum ShapeType: int
8
{
9
    case Null = 0;
10
11
    case Point = 1;
12
13
    case PolyLine = 3;
14
15
    case Polygon = 5;
16
17
    case MultiPoint = 8;
18
19
    case PointZ = 11;
20
21
    case PolyLineZ = 13;
22
23
    case PolygonZ = 15;
24
25
    case MultiPointZ = 18;
26
27
    case PointM = 21;
28
29
    case PolyLineM = 23;
30
31
    case PolygonM = 25;
32
33
    case MultiPointM = 28;
34
35
    case MultiPatch = 31;
36
37
    case Unknown = -1;
38
39
    /** Shape types with a Z coordinate. */
40
    public const TYPES_WITH_Z = [self::PointZ, self::PolyLineZ, self::PolygonZ, self::MultiPointZ];
41
42
    /** Shape types with a measure field. */
43
    public const MEASURED_TYPES = [
44
        self::PointZ,
45
        self::PolyLineZ,
46
        self::PolygonZ,
47
        self::MultiPointZ,
48
        self::PointM,
49
        self::PolyLineM,
50
        self::PolygonM,
51
        self::MultiPointM,
52
    ];
53
54
    public const NAMES = [
55
        self::Unknown->value => 'Unknown Shape',
56
        self::Null->value => 'Null Shape',
57
        self::Point->value => 'Point',
58
        self::PolyLine->value => 'PolyLine',
59
        self::Polygon->value => 'Polygon',
60
        self::MultiPoint->value => 'MultiPoint',
61
        self::PointZ->value => 'PointZ',
62
        self::PolyLineZ->value => 'PolyLineZ',
63
        self::PolygonZ->value => 'PolygonZ',
64
        self::MultiPointZ->value => 'MultiPointZ',
65
        self::PointM->value => 'PointM',
66
        self::PolyLineM->value => 'PolyLineM',
67
        self::PolygonM->value => 'PolygonM',
68
        self::MultiPointM->value => 'MultiPointM',
69
        self::MultiPatch->value => 'MultiPatch',
70
    ];
71
72
    /** @psalm-return non-empty-string */
73 4
    public static function name(ShapeType $shapeType): string
74
    {
75 4
        return self::NAMES[$shapeType->value];
0 ignored issues
show
Bug introduced by
The constant PhpMyAdmin\ShapeFile\ShapeType::NAMES was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
76
    }
77
}
78