Passed
Push — master ( 8387eb...5a11dc )
by Janko
07:59
created

ErrorCodeEnum::getDescription()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 5
nc 1
nop 0
dl 0
loc 7
ccs 6
cts 6
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Stu\Component\ErrorHandling;
6
7
enum ErrorCodeEnum: int
8
{
9
    case LOGIN_NAME_INVALID = 100001;
10
    case EMAIL_ADDRESS_INVALID = 100002;
11
    case REGISTRATION_DUPLICATE = 100003;
12
    case SMS_VERIFICATION_CODE_INVALID = 100009;
13
14 5
    public function getDescription(): string
15
    {
16 5
        return match ($this) {
17 5
            self::LOGIN_NAME_INVALID => 'The provided login name is invalid (invalid characters or invalid length)',
18 3
            self::EMAIL_ADDRESS_INVALID => 'The provided email address is not valid',
19 2
            self::REGISTRATION_DUPLICATE => 'The provided email address or username are already registered',
20 5
            self::SMS_VERIFICATION_CODE_INVALID => 'The provided mobile number is not valid'
21 5
        };
22
    }
23
}
24