ResponseStatus   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 132
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 128
c 2
b 0
f 0
dl 0
loc 132
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
B getText() 0 66 1
1
<?php
2
3
namespace pjpawel\LightApi\Http;
4
5
enum ResponseStatus: int
6
{
7
    case CONTINUE = 100;
8
    case SWITCHING_PROTOCOLS = 101;
9
    case PROCESSING = 102;            
10
    case EARLY_HINTS = 103;           
11
    case OK = 200;
12
    case CREATED = 201;
13
    case ACCEPTED = 202;
14
    case NON_AUTHORITATIVE_INFORMATION = 203;
15
    case NO_CONTENT = 204;
16
    case RESET_CONTENT = 205;
17
    case PARTIAL_CONTENT = 206;
18
    case MULTI_STATUS = 207;          
19
    case ALREADY_REPORTED = 208;      
20
    case IM_USED = 226;               
21
    case MULTIPLE_CHOICES = 300;
22
    case MOVED_PERMANENTLY = 301;
23
    case FOUND = 302;
24
    case SEE_OTHER = 303;
25
    case NOT_MODIFIED = 304;
26
    case USE_PROXY = 305;
27
    case RESERVED = 306;
28
    case TEMPORARY_REDIRECT = 307;
29
    case PERMANENTLY_REDIRECT = 308;  
30
    case BAD_REQUEST = 400;
31
    case UNAUTHORIZED = 401;
32
    case PAYMENT_REQUIRED = 402;
33
    case FORBIDDEN = 403;
34
    case NOT_FOUND = 404;
35
    case METHOD_NOT_ALLOWED = 405;
36
    case NOT_ACCEPTABLE = 406;
37
    case PROXY_AUTHENTICATION_REQUIRED = 407;
38
    case REQUEST_TIMEOUT = 408;
39
    case CONFLICT = 409;
40
    case GONE = 410;
41
    case LENGTH_REQUIRED = 411;
42
    case PRECONDITION_FAILED = 412;
43
    case REQUEST_ENTITY_TOO_LARGE = 413;
44
    case REQUEST_URI_TOO_LONG = 414;
45
    case UNSUPPORTED_MEDIA_TYPE = 415;
46
    case REQUESTED_RANGE_NOT_SATISFIABLE = 416;
47
    case EXPECTATION_FAILED = 417;
48
    case I_AM_A_TEAPOT = 418;                                               
49
    case MISDIRECTED_REQUEST = 421;                                         
50
    case UNPROCESSABLE_ENTITY = 422;                                        
51
    case LOCKED = 423;                                                      
52
    case FAILED_DEPENDENCY = 424;                                           
53
    case TOO_EARLY = 425;                                                   
54
    case UPGRADE_REQUIRED = 426;                                            
55
    case PRECONDITION_REQUIRED = 428;                                       
56
    case TOO_MANY_REQUESTS = 429;                                           
57
    case REQUEST_HEADER_FIELDS_TOO_LARGE = 431;                             
58
    case UNAVAILABLE_FOR_LEGAL_REASONS = 451;                               
59
    case INTERNAL_SERVER_ERROR = 500;
60
    case NOT_IMPLEMENTED = 501;
61
    case BAD_GATEWAY = 502;
62
    case SERVICE_UNAVAILABLE = 503;
63
    case GATEWAY_TIMEOUT = 504;
64
    case VERSION_NOT_SUPPORTED = 505;
65
    case VARIANT_ALSO_NEGOTIATES_EXPERIMENTAL = 506;                        
66
    case INSUFFICIENT_STORAGE = 507;                                        
67
    case LOOP_DETECTED = 508;                                               
68
    case NOT_EXTENDED = 510;                                                
69
    case NETWORK_AUTHENTICATION_REQUIRED = 511;
70
71
    public function getText(): string
72
    {
73
        return match ($this->value) {
74
            100 => 'Continue',
75
            101 => 'Switching Protocols',
76
            102 => 'Processing',
77
            103 => 'Early Hints',
78
            200 => 'OK',
79
            201 => 'Created',
80
            202 => 'Accepted',
81
            203 => 'Non-Authoritative Information',
82
            204 => 'No Content',
83
            205 => 'Reset Content',
84
            206 => 'Partial Content',
85
            207 => 'Multi-Status',
86
            208 => 'Already Reported',
87
            226 => 'IM Used',
88
            300 => 'Multiple Choices',
89
            301 => 'Moved Permanently',
90
            302 => 'Found',
91
            303 => 'See Other',
92
            304 => 'Not Modified',
93
            305 => 'Use Proxy',
94
            306 => 'Reserved',
95
            307 => 'Temporary Redirect',
96
            308 => 'Permanent Redirect',
97
            400 => 'Bad Request',
98
            401 => 'Unauthorized',
99
            402 => 'Payment Required',
100
            403 => 'Forbidden',
101
            404 => 'Not Found',
102
            405 => 'Method Not Allowed',
103
            406 => 'Not Acceptable',
104
            407 => 'Proxy Authentication Required',
105
            408 => 'Request Timeout',
106
            409 => 'Conflict',
107
            410 => 'Gone',
108
            411 => 'Length Required',
109
            412 => 'Precondition Failed',
110
            413 => 'Content Too Large',
111
            414 => 'URI Too Long',
112
            415 => 'Unsupported Media Type',
113
            416 => 'Range Not Satisfiable',
114
            417 => 'Expectation Failed',
115
            418 => 'I\'m a teapot',
116
            421 => 'Misdirected Request',
117
            422 => 'Unprocessable Content',
118
            423 => 'Locked',
119
            424 => 'Failed Dependency',
120
            425 => 'Too Early',
121
            426 => 'Upgrade Required',
122
            428 => 'Precondition Required',
123
            429 => 'Too Many Requests',
124
            431 => 'Request Header Fields Too Large',
125
            451 => 'Unavailable For Legal Reasons',
126
            500 => 'Internal Server Error',
127
            501 => 'Not Implemented',
128
            502 => 'Bad Gateway',
129
            503 => 'Service Unavailable',
130
            504 => 'Gateway Timeout',
131
            505 => 'HTTP Version Not Supported',
132
            506 => 'Variant Also Negotiates',
133
            507 => 'Insufficient Storage',
134
            508 => 'Loop Detected',
135
            510 => 'Not Extended',
136
            511 => 'Network Authentication Required',
137
        };
138
    }
139
}
140