Context.php
4 weeks ago
FileUpload.php
4 weeks ago
Helpers.php
4 weeks ago
IRequest.php
4 weeks ago
IResponse.php
4 weeks ago
Request.php
4 weeks ago
RequestFactory.php
4 weeks ago
Response.php
4 weeks ago
Session.php
4 weeks ago
SessionSection.php
4 weeks ago
Url.php
4 weeks ago
UrlImmutable.php
4 weeks ago
UrlScript.php
4 weeks ago
UserStorage.php
4 weeks ago
IResponse.php
207 lines
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * This file is part of the Nette Framework (https://nette.org) |
| 5 | * Copyright (c) 2004 David Grudl (https://davidgrudl.com) |
| 6 | */ |
| 7 | declare (strict_types=1); |
| 8 | namespace FapiMember\Library\Nette\Http; |
| 9 | |
| 10 | /** |
| 11 | * HTTP response interface. |
| 12 | * @method self deleteHeader(string $name) |
| 13 | */ |
| 14 | interface IResponse |
| 15 | { |
| 16 | /** @deprecated */ |
| 17 | public const PERMANENT = 2116333333; |
| 18 | /** @deprecated */ |
| 19 | public const BROWSER = 0; |
| 20 | /** HTTP 1.1 response code */ |
| 21 | public const S100_Continue = 100, S101_SwitchingProtocols = 101, S102_Processing = 102, S200_OK = 200, S201_Created = 201, S202_Accepted = 202, S203_NonAuthoritativeInformation = 203, S204_NoContent = 204, S205_ResetContent = 205, S206_PartialContent = 206, S207_MultiStatus = 207, S208_AlreadyReported = 208, S226_ImUsed = 226, S300_MultipleChoices = 300, S301_MovedPermanently = 301, S302_Found = 302, S303_PostGet = 303, S304_NotModified = 304, S305_UseProxy = 305, S307_TemporaryRedirect = 307, S308_PermanentRedirect = 308, S400_BadRequest = 400, S401_Unauthorized = 401, S402_PaymentRequired = 402, S403_Forbidden = 403, S404_NotFound = 404, S405_MethodNotAllowed = 405, S406_NotAcceptable = 406, S407_ProxyAuthenticationRequired = 407, S408_RequestTimeout = 408, S409_Conflict = 409, S410_Gone = 410, S411_LengthRequired = 411, S412_PreconditionFailed = 412, S413_RequestEntityTooLarge = 413, S414_RequestUriTooLong = 414, S415_UnsupportedMediaType = 415, S416_RequestedRangeNotSatisfiable = 416, S417_ExpectationFailed = 417, S421_MisdirectedRequest = 421, S422_UnprocessableEntity = 422, S423_Locked = 423, S424_FailedDependency = 424, S426_UpgradeRequired = 426, S428_PreconditionRequired = 428, S429_TooManyRequests = 429, S431_RequestHeaderFieldsTooLarge = 431, S451_UnavailableForLegalReasons = 451, S500_InternalServerError = 500, S501_NotImplemented = 501, S502_BadGateway = 502, S503_ServiceUnavailable = 503, S504_GatewayTimeout = 504, S505_HttpVersionNotSupported = 505, S506_VariantAlsoNegotiates = 506, S507_InsufficientStorage = 507, S508_LoopDetected = 508, S510_NotExtended = 510, S511_NetworkAuthenticationRequired = 511; |
| 22 | public const ReasonPhrases = [100 => 'Continue', 101 => 'Switching Protocols', 102 => 'Processing', 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', 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 Time-out', 409 => 'Conflict', 410 => 'Gone', 411 => 'Length Required', 412 => 'Precondition Failed', 413 => 'Request Entity Too Large', 414 => 'Request-URI Too Large', 415 => 'Unsupported Media Type', 416 => 'Requested range not satisfiable', 417 => 'Expectation Failed', 421 => 'Misdirected Request', 422 => 'Unprocessable Entity', 423 => 'Locked', 424 => 'Failed Dependency', 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 Time-out', 505 => 'HTTP Version not supported', 506 => 'Variant Also Negotiates', 507 => 'Insufficient Storage', 508 => 'Loop Detected', 510 => 'Not Extended', 511 => 'Network Authentication Required']; |
| 23 | /** SameSite cookie */ |
| 24 | public const SameSiteLax = 'Lax', SameSiteStrict = 'Strict', SameSiteNone = 'None'; |
| 25 | /** @deprecated use IResponse::ReasonPhrases */ |
| 26 | public const REASON_PHRASES = self::ReasonPhrases; |
| 27 | /** @deprecated use IResponse::SameSiteLax */ |
| 28 | public const SAME_SITE_LAX = self::SameSiteLax; |
| 29 | /** @deprecated use IResponse::SameSiteStrict */ |
| 30 | public const SAME_SITE_STRICT = self::SameSiteStrict; |
| 31 | /** @deprecated use IResponse::SameSiteNone */ |
| 32 | public const SAME_SITE_NONE = self::SameSiteNone; |
| 33 | /** @deprecated use IResponse::S100_Continue */ |
| 34 | public const S100_CONTINUE = self::S100_Continue; |
| 35 | /** @deprecated use IResponse::S101_SwitchingProtocols */ |
| 36 | public const S101_SWITCHING_PROTOCOLS = self::S101_SwitchingProtocols; |
| 37 | /** @deprecated use IResponse::S102_Processing */ |
| 38 | public const S102_PROCESSING = self::S102_Processing; |
| 39 | /** @deprecated use IResponse::S201_Created */ |
| 40 | public const S201_CREATED = self::S201_Created; |
| 41 | /** @deprecated use IResponse::S202_Accepted */ |
| 42 | public const S202_ACCEPTED = self::S202_Accepted; |
| 43 | /** @deprecated use IResponse::S203_NonAuthoritativeInformation */ |
| 44 | public const S203_NON_AUTHORITATIVE_INFORMATION = self::S203_NonAuthoritativeInformation; |
| 45 | /** @deprecated use IResponse::S204_NoContent */ |
| 46 | public const S204_NO_CONTENT = self::S204_NoContent; |
| 47 | /** @deprecated use IResponse::S205_ResetContent */ |
| 48 | public const S205_RESET_CONTENT = self::S205_ResetContent; |
| 49 | /** @deprecated use IResponse::S206_PartialContent */ |
| 50 | public const S206_PARTIAL_CONTENT = self::S206_PartialContent; |
| 51 | /** @deprecated use IResponse::S207_MultiStatus */ |
| 52 | public const S207_MULTI_STATUS = self::S207_MultiStatus; |
| 53 | /** @deprecated use IResponse::S208_AlreadyReported */ |
| 54 | public const S208_ALREADY_REPORTED = self::S208_AlreadyReported; |
| 55 | /** @deprecated use IResponse::S226_ImUsed */ |
| 56 | public const S226_IM_USED = self::S226_ImUsed; |
| 57 | /** @deprecated use IResponse::S300_MultipleChoices */ |
| 58 | public const S300_MULTIPLE_CHOICES = self::S300_MultipleChoices; |
| 59 | /** @deprecated use IResponse::S301_MovedPermanently */ |
| 60 | public const S301_MOVED_PERMANENTLY = self::S301_MovedPermanently; |
| 61 | /** @deprecated use IResponse::S302_Found */ |
| 62 | public const S302_FOUND = self::S302_Found; |
| 63 | /** @deprecated use IResponse::S303_PostGet */ |
| 64 | public const S303_SEE_OTHER = self::S303_PostGet; |
| 65 | /** @deprecated use IResponse::S303_PostGet */ |
| 66 | public const S303_POST_GET = self::S303_PostGet; |
| 67 | /** @deprecated use IResponse::S304_NotModified */ |
| 68 | public const S304_NOT_MODIFIED = self::S304_NotModified; |
| 69 | /** @deprecated use IResponse::S305_UseProxy */ |
| 70 | public const S305_USE_PROXY = self::S305_UseProxy; |
| 71 | /** @deprecated use IResponse::S307_TemporaryRedirect */ |
| 72 | public const S307_TEMPORARY_REDIRECT = self::S307_TemporaryRedirect; |
| 73 | /** @deprecated use IResponse::S308_PermanentRedirect */ |
| 74 | public const S308_PERMANENT_REDIRECT = self::S308_PermanentRedirect; |
| 75 | /** @deprecated use IResponse::S400_BadRequest */ |
| 76 | public const S400_BAD_REQUEST = self::S400_BadRequest; |
| 77 | /** @deprecated use IResponse::S401_Unauthorized */ |
| 78 | public const S401_UNAUTHORIZED = self::S401_Unauthorized; |
| 79 | /** @deprecated use IResponse::S402_PaymentRequired */ |
| 80 | public const S402_PAYMENT_REQUIRED = self::S402_PaymentRequired; |
| 81 | /** @deprecated use IResponse::S403_Forbidden */ |
| 82 | public const S403_FORBIDDEN = self::S403_Forbidden; |
| 83 | /** @deprecated use IResponse::S404_NotFound */ |
| 84 | public const S404_NOT_FOUND = self::S404_NotFound; |
| 85 | /** @deprecated use IResponse::S405_MethodNotAllowed */ |
| 86 | public const S405_METHOD_NOT_ALLOWED = self::S405_MethodNotAllowed; |
| 87 | /** @deprecated use IResponse::S406_NotAcceptable */ |
| 88 | public const S406_NOT_ACCEPTABLE = self::S406_NotAcceptable; |
| 89 | /** @deprecated use IResponse::S407_ProxyAuthenticationRequired */ |
| 90 | public const S407_PROXY_AUTHENTICATION_REQUIRED = self::S407_ProxyAuthenticationRequired; |
| 91 | /** @deprecated use IResponse::S408_RequestTimeout */ |
| 92 | public const S408_REQUEST_TIMEOUT = self::S408_RequestTimeout; |
| 93 | /** @deprecated use IResponse::S409_Conflict */ |
| 94 | public const S409_CONFLICT = self::S409_Conflict; |
| 95 | /** @deprecated use IResponse::S410_Gone */ |
| 96 | public const S410_GONE = self::S410_Gone; |
| 97 | /** @deprecated use IResponse::S411_LengthRequired */ |
| 98 | public const S411_LENGTH_REQUIRED = self::S411_LengthRequired; |
| 99 | /** @deprecated use IResponse::S412_PreconditionFailed */ |
| 100 | public const S412_PRECONDITION_FAILED = self::S412_PreconditionFailed; |
| 101 | /** @deprecated use IResponse::S413_RequestEntityTooLarge */ |
| 102 | public const S413_REQUEST_ENTITY_TOO_LARGE = self::S413_RequestEntityTooLarge; |
| 103 | /** @deprecated use IResponse::S414_RequestUriTooLong */ |
| 104 | public const S414_REQUEST_URI_TOO_LONG = self::S414_RequestUriTooLong; |
| 105 | /** @deprecated use IResponse::S415_UnsupportedMediaType */ |
| 106 | public const S415_UNSUPPORTED_MEDIA_TYPE = self::S415_UnsupportedMediaType; |
| 107 | /** @deprecated use IResponse::S416_RequestedRangeNotSatisfiable */ |
| 108 | public const S416_REQUESTED_RANGE_NOT_SATISFIABLE = self::S416_RequestedRangeNotSatisfiable; |
| 109 | /** @deprecated use IResponse::S417_ExpectationFailed */ |
| 110 | public const S417_EXPECTATION_FAILED = self::S417_ExpectationFailed; |
| 111 | /** @deprecated use IResponse::S421_MisdirectedRequest */ |
| 112 | public const S421_MISDIRECTED_REQUEST = self::S421_MisdirectedRequest; |
| 113 | /** @deprecated use IResponse::S422_UnprocessableEntity */ |
| 114 | public const S422_UNPROCESSABLE_ENTITY = self::S422_UnprocessableEntity; |
| 115 | /** @deprecated use IResponse::S423_Locked */ |
| 116 | public const S423_LOCKED = self::S423_Locked; |
| 117 | /** @deprecated use IResponse::S424_FailedDependency */ |
| 118 | public const S424_FAILED_DEPENDENCY = self::S424_FailedDependency; |
| 119 | /** @deprecated use IResponse::S426_UpgradeRequired */ |
| 120 | public const S426_UPGRADE_REQUIRED = self::S426_UpgradeRequired; |
| 121 | /** @deprecated use IResponse::S428_PreconditionRequired */ |
| 122 | public const S428_PRECONDITION_REQUIRED = self::S428_PreconditionRequired; |
| 123 | /** @deprecated use IResponse::S429_TooManyRequests */ |
| 124 | public const S429_TOO_MANY_REQUESTS = self::S429_TooManyRequests; |
| 125 | /** @deprecated use IResponse::S431_RequestHeaderFieldsTooLarge */ |
| 126 | public const S431_REQUEST_HEADER_FIELDS_TOO_LARGE = self::S431_RequestHeaderFieldsTooLarge; |
| 127 | /** @deprecated use IResponse::S451_UnavailableForLegalReasons */ |
| 128 | public const S451_UNAVAILABLE_FOR_LEGAL_REASONS = self::S451_UnavailableForLegalReasons; |
| 129 | /** @deprecated use IResponse::S500_InternalServerError */ |
| 130 | public const S500_INTERNAL_SERVER_ERROR = self::S500_InternalServerError; |
| 131 | /** @deprecated use IResponse::S501_NotImplemented */ |
| 132 | public const S501_NOT_IMPLEMENTED = self::S501_NotImplemented; |
| 133 | /** @deprecated use IResponse::S502_BadGateway */ |
| 134 | public const S502_BAD_GATEWAY = self::S502_BadGateway; |
| 135 | /** @deprecated use IResponse::S503_ServiceUnavailable */ |
| 136 | public const S503_SERVICE_UNAVAILABLE = self::S503_ServiceUnavailable; |
| 137 | /** @deprecated use IResponse::S504_GatewayTimeout */ |
| 138 | public const S504_GATEWAY_TIMEOUT = self::S504_GatewayTimeout; |
| 139 | /** @deprecated use IResponse::S505_HttpVersionNotSupported */ |
| 140 | public const S505_HTTP_VERSION_NOT_SUPPORTED = self::S505_HttpVersionNotSupported; |
| 141 | /** @deprecated use IResponse::S506_VariantAlsoNegotiates */ |
| 142 | public const S506_VARIANT_ALSO_NEGOTIATES = self::S506_VariantAlsoNegotiates; |
| 143 | /** @deprecated use IResponse::S507_InsufficientStorage */ |
| 144 | public const S507_INSUFFICIENT_STORAGE = self::S507_InsufficientStorage; |
| 145 | /** @deprecated use IResponse::S508_LoopDetected */ |
| 146 | public const S508_LOOP_DETECTED = self::S508_LoopDetected; |
| 147 | /** @deprecated use IResponse::S510_NotExtended */ |
| 148 | public const S510_NOT_EXTENDED = self::S510_NotExtended; |
| 149 | /** @deprecated use IResponse::S511_NetworkAuthenticationRequired */ |
| 150 | public const S511_NETWORK_AUTHENTICATION_REQUIRED = self::S511_NetworkAuthenticationRequired; |
| 151 | /** |
| 152 | * Sets HTTP response code. |
| 153 | * @return static |
| 154 | */ |
| 155 | function setCode(int $code, ?string $reason = null); |
| 156 | /** |
| 157 | * Returns HTTP response code. |
| 158 | */ |
| 159 | function getCode(): int; |
| 160 | /** |
| 161 | * Sends a HTTP header and replaces a previous one. |
| 162 | * @return static |
| 163 | */ |
| 164 | function setHeader(string $name, string $value); |
| 165 | /** |
| 166 | * Adds HTTP header. |
| 167 | * @return static |
| 168 | */ |
| 169 | function addHeader(string $name, string $value); |
| 170 | /** |
| 171 | * Sends a Content-type HTTP header. |
| 172 | * @return static |
| 173 | */ |
| 174 | function setContentType(string $type, ?string $charset = null); |
| 175 | /** |
| 176 | * Redirects to a new URL. |
| 177 | */ |
| 178 | function redirect(string $url, int $code = self::S302_Found): void; |
| 179 | /** |
| 180 | * Sets the time (like '20 minutes') before a page cached on a browser expires, null means "must-revalidate". |
| 181 | * @return static |
| 182 | */ |
| 183 | function setExpiration(?string $expire); |
| 184 | /** |
| 185 | * Checks if headers have been sent. |
| 186 | */ |
| 187 | function isSent(): bool; |
| 188 | /** |
| 189 | * Returns value of an HTTP header. |
| 190 | */ |
| 191 | function getHeader(string $header): ?string; |
| 192 | /** |
| 193 | * Returns an associative array of headers to sent. |
| 194 | */ |
| 195 | function getHeaders(): array; |
| 196 | /** |
| 197 | * Sends a cookie. |
| 198 | * @param string|int|\DateTimeInterface $expire time, value null means "until the browser session ends" |
| 199 | * @return static |
| 200 | */ |
| 201 | function setCookie(string $name, string $value, $expire, ?string $path = null, ?string $domain = null, ?bool $secure = null, ?bool $httpOnly = null); |
| 202 | /** |
| 203 | * Deletes a cookie. |
| 204 | */ |
| 205 | function deleteCookie(string $name, ?string $path = null, ?string $domain = null, ?bool $secure = null); |
| 206 | } |
| 207 |