HttpStatusCode   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 77
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 1
lcom 1
cbo 0
dl 0
loc 77
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getMessage() 0 4 1
1
<?php
2
3
namespace BWC\Share\Net;
4
5
6
class HttpStatusCode
7
{
8
    const CONTINUE_ = 100;
9
    const SWITCHING_PROTOCOLS = 101;
10
11
    const OK = 200;
12
    const CREATED = 201;
13
    const ACCEPTED = 202;
14
    const NON_AUTHORITATIVE_INFORMATION = 203;
15
    const NO_CONTENT = 204;
16
17
    const MOVED_PERMANENTLY = 304;
18
    const FOUND = 302;
19
    const TEMPORARY_REDIRECT = 307;
20
21
    const BAD_REQUEST = 400;
22
    const UNAUTHORIZED = 401;
23
    const FORBIDDEN = 403;
24
    const NOT_FOUND = 404;
25
    const METHOD_NOT_ALLOWED = 405;
26
27
    const INTERNAL_SERVER_ERROR = 500;
28
    const NOT_IMPLEMENTED = 501;
29
    const SERVICE_UNAVAILABLE = 503;
30
    const HTTP_VERSION_NOT_SUPPORTED = 505;
31
32
33
    private static $codes = array(
34
        0   => 'Connection failed',
35
        100 => 'Continue',
36
        101 => 'Switching Protocols',
37
        200 => 'OK',
38
        201 => 'Created',
39
        202 => 'Accepted',
40
        203 => 'Non-Authoritative Information',
41
        204 => 'No Content',
42
        205 => 'Reset Content',
43
        206 => 'Partial Content',
44
        300 => 'Multiple Choices',
45
        301 => 'Moved Permanently',
46
        302 => 'Found',
47
        303 => 'See Other',
48
        304 => 'Not Modified',
49
        305 => 'Use Proxy',
50
        307 => 'Temporary Redirect',
51
        400 => 'Bad Request',
52
        401 => 'Unauthorized',
53
        403 => 'Forbidden',
54
        404 => 'Not Found',
55
        405 => 'Method Not Allowed',
56
        406 => 'Not Acceptable',
57
        407 => 'Proxy Authentication Required',
58
        408 => 'Request Timeout',
59
        409 => 'Conflict',
60
        410 => 'Gone',
61
        411 => 'Length Required',
62
        412 => 'Precondition Failed',
63
        413 => 'Request Entity Too Large',
64
        414 => 'Request URI Too Long',
65
        415 => 'Unsupported Media Type',
66
        416 => 'Requested Range Not Satisfiable',
67
        417 => 'Expectation Failed',
68
        500 => 'Internal Server Error',
69
        501 => 'Not Implemented',
70
        502 => 'Bad Gateway',
71
        503 => 'Service Unavailable',
72
        504 => 'Gateway Timeout',
73
        505 => 'HTTP Version Not Supported',
74
    );
75
76
77
    static function getMessage($code) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
78
        $result = self::$codes[$code];
79
        return $result;
80
    }
81
82
}