Skip to content

Commit 82345d4

Browse files
committed
Added Constants namespaces
1 parent da708d1 commit 82345d4

File tree

4 files changed

+92
-2
lines changed

4 files changed

+92
-2
lines changed

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
"autoload": {
2020
"psr-4": {
2121
"Francerz\\Http\\Tools\\": "src/tools",
22-
"Francerz\\Http\\Headers\\": "src/headers"
22+
"Francerz\\Http\\Headers\\": "src/headers",
23+
"Francerz\\Http\\Constants\\": "src/constants"
2324
}
2425
}
2526
}

src/tools/MediaTypes.php renamed to src/constants/MediaTypes.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace Francerz\Http\Tools;
3+
namespace Francerz\Http\Constants;
44

55
class MediaTypes
66
{

src/constants/Methods.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
namespace Francerz\Http\Constants;
4+
5+
class Methods
6+
{
7+
const DELETE = 'DELETE';
8+
const GET = 'GET';
9+
const HEAD = 'HEAD';
10+
const OPTIONS = 'OPTIONS';
11+
const PATCH = 'PATCH';
12+
const POST = 'POST';
13+
const PUT = 'PUT';
14+
}

src/constants/StatusCodes.php

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
<?php
2+
3+
namespace Francerz\Http\Constants;
4+
5+
class StatusCodes
6+
{
7+
// INFORMATIONAL RESPONSE
8+
const INFO_CONTINUE = 100;
9+
const INFO_SWITCHING_PROTOCOLS = 101;
10+
const INFO_PROCESSING = 102;
11+
const INFO_EARLY_HINTS = 103;
12+
// SUCCESS
13+
const SUCCESS_OK = 200;
14+
const SUCCESS_CREATED = 201;
15+
const SUCCESS_ACCEPTED = 202;
16+
const SUCCESS_NON_AUTHORITATIVE_INFORMATION = 203;
17+
const SUCCESS_NO_CONTENT = 204;
18+
const SUCCESS_RESET_CONTENT = 205;
19+
const SUCCESS_PARTIAL_CONTENT = 206;
20+
const SUCCESS_MULTI_STATUS = 207;
21+
const SUCCESS_ALREADY_REPORTED = 208;
22+
const SUCCESS_IM_USED = 226;
23+
// REDIRECTION
24+
const REDIRECT_MULTPLE_CHOICES = 300;
25+
const REDIRECT_MOVED_PERMANENTLY = 301;
26+
const REDIRECT_FOUND = 302;
27+
const REDIRECT_SEE_OTHER = 303;
28+
const REDIRECT_NOT_MODIFIED = 304;
29+
const REDIRECT_USE_PROXY = 305;
30+
const REDIRECT_SWITCH_PROXY = 306;
31+
const REDIRECT_TEMPORARY_REDIRECT = 307;
32+
const REDIRECT_PERMANENT_REDIRECT = 308;
33+
// CLIENT ERRORS
34+
const CLIENT_ERROR_BAD_REQUEST = 400;
35+
const CLIENT_ERROR_UNAUTHORIZED = 401;
36+
const CLIENT_ERROR_PAYMENT_REQUIRED = 402;
37+
const CLIENT_ERROR_FORBIDDEN = 403;
38+
const CLIENT_ERROR_NOT_FOUND = 404;
39+
const CLIENT_ERROR_METHOD_NOT_ALLOWED = 405;
40+
const CLIENT_ERROR_NOT_ACCEPTABLE = 406;
41+
const CLIENT_ERROR_PROXY_AUTHENTICATION_REQUIRED = 407;
42+
const CLIENT_ERROR_REQUEST_TIMEOUT = 408;
43+
const CLIENT_ERROR_CONFLICT = 409;
44+
const CLIENT_ERROR_GONE = 410;
45+
const CLIENT_ERROR_LENGTH_REQUIRED = 411;
46+
const CLIENT_ERROR_PRECONDITION_FAILED = 412;
47+
const CLIENT_ERROR_PAYLOAD_TOO_LARGE = 413;
48+
const CLIENT_ERROR_URI_TOO_LONG = 414;
49+
const CLIENT_ERROR_UNSUPPORTED_MEDIA_TYPE = 415;
50+
const CLIENT_ERROR_RANGE_NOT_SATISFIABLE = 416;
51+
const CLIENT_ERROR_EXPECTATION_FAILED = 417;
52+
const CLIENT_ERROR_IM_A_TEAPOD = 418;
53+
const CLIENT_ERROR_MISDIRECTED_REQUEST = 421;
54+
const CLIENT_ERROR_UNPROCESSABLE_ENTITY = 422;
55+
const CLIENT_ERROR_LOCKED = 423;
56+
const CLIENT_ERROR_FAILED_DEPENDENCY = 424;
57+
const CLIENT_ERROR_TOO_EARLY = 425;
58+
const CLIENT_ERROR_UPGRADE_REQUIRED = 426;
59+
const CLIENT_ERROR_PRECONDITON_REQUIRED = 428;
60+
const CLIENT_ERROR_TOO_MANY_REQUESTS = 429;
61+
const CLIENT_ERROR_REQUEST_HEADER_FIELDS_TOO_LARGE = 429;
62+
const CLIENT_ERROR_UNAVAILABLE_FOR_LEGAL_REASONS = 451;
63+
// SERVER ERRORS
64+
const SERVER_ERROR_INTERNAL_SERVER_ERROR = 500;
65+
const SERVER_ERROR_NOT_IMPLEMENTED = 501;
66+
const SERVER_ERROR_BAD_GATEWAY = 502;
67+
const SERVER_ERROR_SERVICE_UNAVAILABLE = 503;
68+
const SERVER_ERROR_GATEWAY_TIMEOUT = 504;
69+
const SERVER_ERROR_HTTP_VERSION_NOT_SUPPORTED = 505;
70+
const SERVER_ERROR_VARIANT_ALSO_NEGOTIATES = 506;
71+
const SERVER_ERROR_INSUFFICIENT_STORAGE = 507;
72+
const SERVER_ERROR_LOOP_DETECTED = 508;
73+
const SERVER_ERROR_NOT_EXTENDED = 510;
74+
const SERVER_ERROR_NETWORK_AUTHENTICATION_REQUIRED = 511;
75+
}

0 commit comments

Comments
 (0)