Failed Conditions
Push — master ( 0ef5da...6c8847 )
by Adrien
11:04 queued 07:56
created

TestEnum::getDescription()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 5
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace EcodevTests\Felix\Service;
6
7
use Ecodev\Felix\Api\Enum\LocalizedPhpEnumType;
8
9
enum TestEnum: string implements LocalizedPhpEnumType
10
{
11
    case key1 = 'value1';
12
    case key2 = 'value2';
13
14
    public function getDescription(): string
15
    {
16
        return match ($this) {
17
            TestEnum::key1 => 'custom description for key 1',
18
            TestEnum::key2 => 'other for key 2',
19
        };
20
    }
21
}
22