HumHub Documentation (unofficial)

HttpCode
in package

Class containing constants of HTTP Status Codes and method to print HTTP code with its description.

Usage:

<?php
use \Codeception\Util\HttpCode;

// using REST, PhpBrowser, or any Framework module
$I->seeResponseCodeIs(HttpCode::OK);
$I->dontSeeResponseCodeIs(HttpCode::NOT_FOUND);

Table of Contents

Constants

ACCEPTED  = 202
ALREADY_REPORTED  = 208
BAD_GATEWAY  = 502
BAD_REQUEST  = 400
CONFLICT  = 409
CREATED  = 201
EARLY_HINTS  = 103
EXPECTATION_FAILED  = 417
FAILED_DEPENDENCY  = 424
FORBIDDEN  = 403
FOUND  = 302
GATEWAY_TIMEOUT  = 504
GONE  = 410
I_AM_A_TEAPOT  = 418
IM_USED  = 226
INSUFFICIENT_STORAGE  = 507
INTERNAL_SERVER_ERROR  = 500
LENGTH_REQUIRED  = 411
LOCKED  = 423
LOOP_DETECTED  = 508
METHOD_NOT_ALLOWED  = 405
MISDIRECTED_REQUEST  = 421
MOVED_PERMANENTLY  = 301
MULTI_STATUS  = 207
MULTIPLE_CHOICES  = 300
NETWORK_AUTHENTICATION_REQUIRED  = 511
NO_CONTENT  = 204
NON_AUTHORITATIVE_INFORMATION  = 203
NOT_ACCEPTABLE  = 406
NOT_EXTENDED  = 510
NOT_FOUND  = 404
NOT_IMPLEMENTED  = 501
NOT_MODIFIED  = 304
OK  = 200
PARTIAL_CONTENT  = 206
PAYMENT_REQUIRED  = 402
PERMANENTLY_REDIRECT  = 308
PRECONDITION_FAILED  = 412
PRECONDITION_REQUIRED  = 428
PROCESSING  = 102
PROXY_AUTHENTICATION_REQUIRED  = 407
REQUEST_ENTITY_TOO_LARGE  = 413
REQUEST_HEADER_FIELDS_TOO_LARGE  = 431
REQUEST_TIMEOUT  = 408
REQUEST_URI_TOO_LONG  = 414
REQUESTED_RANGE_NOT_SATISFIABLE  = 416
RESERVED  = 306
RESERVED_FOR_WEBDAV_ADVANCED_COLLECTIONS_EXPIRED_PROPOSAL  = 425
RESET_CONTENT  = 205
SEE_OTHER  = 303
SERVICE_UNAVAILABLE  = 503
SWITCHING_PROTOCOLS  = 101
TEMPORARY_REDIRECT  = 307
TOO_MANY_REQUESTS  = 429
UNAUTHORIZED  = 401
UNAVAILABLE_FOR_LEGAL_REASONS  = 451
UNPROCESSABLE_ENTITY  = 422
UNSUPPORTED_MEDIA_TYPE  = 415
UPGRADE_REQUIRED  = 426
USE_PROXY  = 305
VARIANT_ALSO_NEGOTIATES_EXPERIMENTAL  = 506
VERSION_NOT_SUPPORTED  = 505

Properties

$codes  : array<int, string>

Methods

getDescription()  : int|string
Returns string with HTTP code and its description

Constants

ALREADY_REPORTED

public int ALREADY_REPORTED = 208

BAD_GATEWAY

public int BAD_GATEWAY = 502

BAD_REQUEST

public int BAD_REQUEST = 400

EARLY_HINTS

public int EARLY_HINTS = 103

EXPECTATION_FAILED

public int EXPECTATION_FAILED = 417

FAILED_DEPENDENCY

public int FAILED_DEPENDENCY = 424

GATEWAY_TIMEOUT

public int GATEWAY_TIMEOUT = 504

I_AM_A_TEAPOT

public int I_AM_A_TEAPOT = 418

INSUFFICIENT_STORAGE

public int INSUFFICIENT_STORAGE = 507

INTERNAL_SERVER_ERROR

public int INTERNAL_SERVER_ERROR = 500

LENGTH_REQUIRED

public int LENGTH_REQUIRED = 411

LOOP_DETECTED

public int LOOP_DETECTED = 508

METHOD_NOT_ALLOWED

public int METHOD_NOT_ALLOWED = 405

MISDIRECTED_REQUEST

public int MISDIRECTED_REQUEST = 421

MOVED_PERMANENTLY

public int MOVED_PERMANENTLY = 301

MULTI_STATUS

public int MULTI_STATUS = 207

MULTIPLE_CHOICES

public int MULTIPLE_CHOICES = 300

NETWORK_AUTHENTICATION_REQUIRED

public int NETWORK_AUTHENTICATION_REQUIRED = 511

NON_AUTHORITATIVE_INFORMATION

public int NON_AUTHORITATIVE_INFORMATION = 203

NOT_ACCEPTABLE

public int NOT_ACCEPTABLE = 406

NOT_EXTENDED

public int NOT_EXTENDED = 510

NOT_IMPLEMENTED

public int NOT_IMPLEMENTED = 501

NOT_MODIFIED

public int NOT_MODIFIED = 304

PARTIAL_CONTENT

public int PARTIAL_CONTENT = 206

PAYMENT_REQUIRED

public int PAYMENT_REQUIRED = 402

PERMANENTLY_REDIRECT

public int PERMANENTLY_REDIRECT = 308

PRECONDITION_FAILED

public int PRECONDITION_FAILED = 412

PRECONDITION_REQUIRED

public int PRECONDITION_REQUIRED = 428

PROXY_AUTHENTICATION_REQUIRED

public int PROXY_AUTHENTICATION_REQUIRED = 407

REQUEST_ENTITY_TOO_LARGE

public int REQUEST_ENTITY_TOO_LARGE = 413

REQUEST_HEADER_FIELDS_TOO_LARGE

public int REQUEST_HEADER_FIELDS_TOO_LARGE = 431

REQUEST_TIMEOUT

public int REQUEST_TIMEOUT = 408

REQUEST_URI_TOO_LONG

public int REQUEST_URI_TOO_LONG = 414

REQUESTED_RANGE_NOT_SATISFIABLE

public int REQUESTED_RANGE_NOT_SATISFIABLE = 416

RESERVED_FOR_WEBDAV_ADVANCED_COLLECTIONS_EXPIRED_PROPOSAL

public int RESERVED_FOR_WEBDAV_ADVANCED_COLLECTIONS_EXPIRED_PROPOSAL = 425

RESET_CONTENT

public int RESET_CONTENT = 205

SERVICE_UNAVAILABLE

public int SERVICE_UNAVAILABLE = 503

SWITCHING_PROTOCOLS

public int SWITCHING_PROTOCOLS = 101

TEMPORARY_REDIRECT

public int TEMPORARY_REDIRECT = 307

TOO_MANY_REQUESTS

public int TOO_MANY_REQUESTS = 429

UNAUTHORIZED

public int UNAUTHORIZED = 401
public int UNAVAILABLE_FOR_LEGAL_REASONS = 451

UNPROCESSABLE_ENTITY

public int UNPROCESSABLE_ENTITY = 422

UNSUPPORTED_MEDIA_TYPE

public int UNSUPPORTED_MEDIA_TYPE = 415

UPGRADE_REQUIRED

public int UPGRADE_REQUIRED = 426

VARIANT_ALSO_NEGOTIATES_EXPERIMENTAL

public int VARIANT_ALSO_NEGOTIATES_EXPERIMENTAL = 506

VERSION_NOT_SUPPORTED

public int VERSION_NOT_SUPPORTED = 505

Properties

$codes

private static array<int, string> $codes = [100 => 'Continue', 102 => 'Processing', 103 => 'Early Hints', 200 => 'OK', 201 => 'Created', 202 => 'Accepted', 203 => 'Non-Authoritative Information', 204 => 'No Content', 205 => 'Reset Content', 206 => 'Partial Content', 207 => 'Multi-Status', 208 => 'Already Reported', 226 => 'IM Used', 300 => 'Multiple Choices', 301 => 'Moved Permanently', 302 => 'Found', 303 => 'See Other', 304 => 'Not Modified', 305 => 'Use Proxy', 306 => 'Reserved', 307 => 'Temporary Redirect', 308 => 'Permanent Redirect', 400 => 'Bad Request', 401 => 'Unauthorized', 402 => 'Payment Required', 403 => 'Forbidden', 404 => 'Not Found', 405 => 'Method Not Allowed', 406 => 'Not Acceptable', 407 => 'Proxy Authentication Required', 408 => 'Request Timeout', 409 => 'Conflict', 410 => 'Gone', 411 => 'Length Required', 412 => 'Precondition Failed', 413 => 'Request Entity Too Large', 414 => 'Request-URI Too Long', 415 => 'Unsupported Media Type', 416 => 'Requested Range Not Satisfiable', 417 => 'Expectation Failed', 418 => 'Unassigned', 421 => 'Misdirected Request', 422 => 'Unprocessable Entity', 423 => 'Locked', 424 => 'Failed Dependency', 425 => 'Too Early', 426 => 'Upgrade Required', 428 => 'Precondition Required', 429 => 'Too Many Requests', 431 => 'Request Header Fields Too Large', 451 => 'Unavailable For Legal Reasons', 500 => 'Internal Server Error', 501 => 'Not Implemented', 502 => 'Bad Gateway', 503 => 'Service Unavailable', 504 => 'Gateway Timeout', 505 => 'HTTP Version Not Supported', 506 => 'Variant Also Negotiates', 507 => 'Insufficient Storage', 508 => 'Loop Detected', 510 => 'Not Extended', 511 => 'Network Authentication Required']

Methods

getDescription()

Returns string with HTTP code and its description

public static getDescription(int $code) : int|string
<?php
HttpCode::getDescription(200); // '200 (OK)'
HttpCode::getDescription(401); // '401 (Unauthorized)'
Parameters
$code : int
Return values
int|string

        
On this page

Search results