platform/api/symfony/Component/HttpFoundation/Response.yaml
2024-09-02 10:44:11 -07:00

916 lines
24 KiB
YAML

name: Response
class_comment: '# * Response represents an HTTP response.
# *
# * @author Fabien Potencier <fabien@symfony.com>'
dependencies: []
properties: []
methods:
- name: __construct
visibility: public
parameters:
- name: content
default: ''''''
- name: status
default: '200'
- name: headers
default: '[]'
comment: "# * Response represents an HTTP response.\n# *\n# * @author Fabien Potencier\
\ <fabien@symfony.com>\n# */\n# class Response\n# {\n# public const HTTP_CONTINUE\
\ = 100;\n# public const HTTP_SWITCHING_PROTOCOLS = 101;\n# public const HTTP_PROCESSING\
\ = 102; // RFC2518\n# public const HTTP_EARLY_HINTS = 103; \
\ // RFC8297\n# public const HTTP_OK = 200;\n# public const HTTP_CREATED =\
\ 201;\n# public const HTTP_ACCEPTED = 202;\n# public const HTTP_NON_AUTHORITATIVE_INFORMATION\
\ = 203;\n# public const HTTP_NO_CONTENT = 204;\n# public const HTTP_RESET_CONTENT\
\ = 205;\n# public const HTTP_PARTIAL_CONTENT = 206;\n# public const HTTP_MULTI_STATUS\
\ = 207; // RFC4918\n# public const HTTP_ALREADY_REPORTED = 208; \
\ // RFC5842\n# public const HTTP_IM_USED = 226; // RFC3229\n#\
\ public const HTTP_MULTIPLE_CHOICES = 300;\n# public const HTTP_MOVED_PERMANENTLY\
\ = 301;\n# public const HTTP_FOUND = 302;\n# public const HTTP_SEE_OTHER = 303;\n\
# public const HTTP_NOT_MODIFIED = 304;\n# public const HTTP_USE_PROXY = 305;\n\
# public const HTTP_RESERVED = 306;\n# public const HTTP_TEMPORARY_REDIRECT =\
\ 307;\n# public const HTTP_PERMANENTLY_REDIRECT = 308; // RFC7238\n# public\
\ const HTTP_BAD_REQUEST = 400;\n# public const HTTP_UNAUTHORIZED = 401;\n# public\
\ const HTTP_PAYMENT_REQUIRED = 402;\n# public const HTTP_FORBIDDEN = 403;\n#\
\ public const HTTP_NOT_FOUND = 404;\n# public const HTTP_METHOD_NOT_ALLOWED =\
\ 405;\n# public const HTTP_NOT_ACCEPTABLE = 406;\n# public const HTTP_PROXY_AUTHENTICATION_REQUIRED\
\ = 407;\n# public const HTTP_REQUEST_TIMEOUT = 408;\n# public const HTTP_CONFLICT\
\ = 409;\n# public const HTTP_GONE = 410;\n# public const HTTP_LENGTH_REQUIRED\
\ = 411;\n# public const HTTP_PRECONDITION_FAILED = 412;\n# public const HTTP_REQUEST_ENTITY_TOO_LARGE\
\ = 413;\n# public const HTTP_REQUEST_URI_TOO_LONG = 414;\n# public const HTTP_UNSUPPORTED_MEDIA_TYPE\
\ = 415;\n# public const HTTP_REQUESTED_RANGE_NOT_SATISFIABLE = 416;\n# public\
\ const HTTP_EXPECTATION_FAILED = 417;\n# public const HTTP_I_AM_A_TEAPOT = 418;\
\ // RFC2324\n# public const HTTP_MISDIRECTED_REQUEST\
\ = 421; // RFC7540\n# public const HTTP_UNPROCESSABLE_ENTITY\
\ = 422; // RFC4918\n# public const HTTP_LOCKED\
\ = 423; // RFC4918\n# public\
\ const HTTP_FAILED_DEPENDENCY = 424; \
\ // RFC4918\n# public const HTTP_TOO_EARLY = 425; \
\ // RFC-ietf-httpbis-replay-04\n# public const HTTP_UPGRADE_REQUIRED\
\ = 426; // RFC2817\n# public const\
\ HTTP_PRECONDITION_REQUIRED = 428; // RFC6585\n\
# public const HTTP_TOO_MANY_REQUESTS = 429; \
\ // RFC6585\n# public const HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE = 431;\
\ // RFC6585\n# public const HTTP_UNAVAILABLE_FOR_LEGAL_REASONS\
\ = 451; // RFC7725\n# public const HTTP_INTERNAL_SERVER_ERROR\
\ = 500;\n# public const HTTP_NOT_IMPLEMENTED = 501;\n# public const HTTP_BAD_GATEWAY\
\ = 502;\n# public const HTTP_SERVICE_UNAVAILABLE = 503;\n# public const HTTP_GATEWAY_TIMEOUT\
\ = 504;\n# public const HTTP_VERSION_NOT_SUPPORTED = 505;\n# public const HTTP_VARIANT_ALSO_NEGOTIATES_EXPERIMENTAL\
\ = 506; // RFC2295\n# public const HTTP_INSUFFICIENT_STORAGE\
\ = 507; // RFC4918\n# public const HTTP_LOOP_DETECTED\
\ = 508; // RFC5842\n# public const\
\ HTTP_NOT_EXTENDED = 510; // RFC2774\n\
# public const HTTP_NETWORK_AUTHENTICATION_REQUIRED = 511; \
\ // RFC6585\n# \n# /**\n# * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control\n\
# */\n# private const HTTP_RESPONSE_CACHE_CONTROL_DIRECTIVES = [\n# 'must_revalidate'\
\ => false,\n# 'no_cache' => false,\n# 'no_store' => false,\n# 'no_transform'\
\ => false,\n# 'public' => false,\n# 'private' => false,\n# 'proxy_revalidate'\
\ => false,\n# 'max_age' => true,\n# 's_maxage' => true,\n# 'stale_if_error' =>\
\ true, // RFC5861\n# 'stale_while_revalidate' => true, // RFC5861\n#\
\ 'immutable' => false,\n# 'last_modified' => true,\n# 'etag' => true,\n# ];\n\
# \n# public ResponseHeaderBag $headers;\n# \n# protected string $content;\n#\
\ protected string $version;\n# protected int $statusCode;\n# protected string\
\ $statusText;\n# protected ?string $charset = null;\n# \n# /**\n# * Status codes\
\ translation table.\n# *\n# * The list of codes is complete according to the\n\
# * {@link https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml\
\ Hypertext Transfer Protocol (HTTP) Status Code Registry}\n# * (last updated\
\ 2021-10-01).\n# *\n# * Unless otherwise noted, the status code is defined in\
\ RFC2616.\n# */\n# public static array $statusTexts = [\n# 100 => 'Continue',\n\
# 101 => 'Switching Protocols',\n# 102 => 'Processing', // RFC2518\n\
# 103 => 'Early Hints',\n# 200 => 'OK',\n# 201 => 'Created',\n# 202 => 'Accepted',\n\
# 203 => 'Non-Authoritative Information',\n# 204 => 'No Content',\n# 205 => 'Reset\
\ Content',\n# 206 => 'Partial Content',\n# 207 => 'Multi-Status', //\
\ RFC4918\n# 208 => 'Already Reported', // RFC5842\n# 226 => 'IM Used', \
\ // RFC3229\n# 300 => 'Multiple Choices',\n# 301 => 'Moved Permanently',\n\
# 302 => 'Found',\n# 303 => 'See Other',\n# 304 => 'Not Modified',\n# 305 => 'Use\
\ Proxy',\n# 307 => 'Temporary Redirect',\n# 308 => 'Permanent Redirect', //\
\ RFC7238\n# 400 => 'Bad Request',\n# 401 => 'Unauthorized',\n# 402 => 'Payment\
\ Required',\n# 403 => 'Forbidden',\n# 404 => 'Not Found',\n# 405 => 'Method Not\
\ Allowed',\n# 406 => 'Not Acceptable',\n# 407 => 'Proxy Authentication Required',\n\
# 408 => 'Request Timeout',\n# 409 => 'Conflict',\n# 410 => 'Gone',\n# 411 =>\
\ 'Length Required',\n# 412 => 'Precondition Failed',\n# 413 => 'Content Too Large',\
\ // RFC-ietf-httpbis-semantics\n# 414\
\ => 'URI Too Long',\n# 415 => 'Unsupported Media Type',\n# 416 => 'Range Not\
\ Satisfiable',\n# 417 => 'Expectation Failed',\n# 418 => 'I\\'m a teapot', \
\ // RFC2324\n# 421 => 'Misdirected\
\ Request', // RFC7540\n# 422 => 'Unprocessable\
\ Content', // RFC-ietf-httpbis-semantics\n\
# 423 => 'Locked', // RFC4918\n\
# 424 => 'Failed Dependency', // RFC4918\n\
# 425 => 'Too Early', // RFC-ietf-httpbis-replay-04\n\
# 426 => 'Upgrade Required', // RFC2817\n\
# 428 => 'Precondition Required', // RFC6585\n\
# 429 => 'Too Many Requests', // RFC6585\n\
# 431 => 'Request Header Fields Too Large', // RFC6585\n\
# 451 => 'Unavailable For Legal Reasons', // RFC7725\n\
# 500 => 'Internal Server Error',\n# 501 => 'Not Implemented',\n# 502 => 'Bad\
\ Gateway',\n# 503 => 'Service Unavailable',\n# 504 => 'Gateway Timeout',\n# 505\
\ => 'HTTP Version Not Supported',\n# 506 => 'Variant Also Negotiates', \
\ // RFC2295\n# 507 => 'Insufficient Storage', \
\ // RFC4918\n# 508 => 'Loop Detected',\
\ // RFC5842\n# 510 => 'Not Extended',\
\ // RFC2774\n# 511 => 'Network\
\ Authentication Required', // RFC6585\n# ];\n# \n\
# /**\n# * Tracks headers already sent in informational responses.\n# */\n# private\
\ array $sentHeaders;\n# \n# /**\n# * @param int $status The HTTP status code\
\ (200 \"OK\" by default)\n# *\n# * @throws \\InvalidArgumentException When the\
\ HTTP status code is not valid"
- name: __toString
visibility: public
parameters: []
comment: '# * Returns the Response as an HTTP string.
# *
# * The string representation of the Response is the same as the
# * one that will be sent to the client only if the prepare() method
# * has been called before.
# *
# * @see prepare()'
- name: __clone
visibility: public
parameters: []
comment: '# * Clones the current Response instance.'
- name: prepare
visibility: public
parameters:
- name: request
comment: '# * Prepares the Response before it is sent to the client.
# *
# * This method tweaks the Response to ensure that it is
# * compliant with RFC 2616. Most of the changes are based on
# * the Request that is "associated" with this Response.
# *
# * @return $this'
- name: sendHeaders
visibility: public
parameters:
- name: statusCode
default: 'null'
comment: '# * Sends HTTP headers.
# *
# * @param positive-int|null $statusCode The status code to use, override the
statusCode property if set and not null
# *
# * @return $this'
- name: sendContent
visibility: public
parameters: []
comment: '# * Sends content for the current web response.
# *
# * @return $this'
- name: send
visibility: public
parameters:
- name: flush
default: 'true'
comment: '# * Sends HTTP headers and content.
# *
# * @param bool $flush Whether output buffers should be flushed
# *
# * @return $this'
- name: setContent
visibility: public
parameters:
- name: content
comment: '# * Sets the response content.
# *
# * @return $this'
- name: getContent
visibility: public
parameters: []
comment: '# * Gets the current response content.'
- name: setProtocolVersion
visibility: public
parameters:
- name: version
comment: '# * Sets the HTTP protocol version (1.0 or 1.1).
# *
# * @return $this
# *
# * @final'
- name: getProtocolVersion
visibility: public
parameters: []
comment: '# * Gets the HTTP protocol version.
# *
# * @final'
- name: setStatusCode
visibility: public
parameters:
- name: code
- name: text
default: 'null'
comment: '# * Sets the response status code.
# *
# * If the status text is null it will be automatically populated for the known
# * status codes and left empty otherwise.
# *
# * @return $this
# *
# * @throws \InvalidArgumentException When the HTTP status code is not valid
# *
# * @final'
- name: getStatusCode
visibility: public
parameters: []
comment: '# * Retrieves the status code for the current web response.
# *
# * @final'
- name: setCharset
visibility: public
parameters:
- name: charset
comment: '# * Sets the response charset.
# *
# * @return $this
# *
# * @final'
- name: getCharset
visibility: public
parameters: []
comment: '# * Retrieves the response charset.
# *
# * @final'
- name: isCacheable
visibility: public
parameters: []
comment: '# * Returns true if the response may safely be kept in a shared (surrogate)
cache.
# *
# * Responses marked "private" with an explicit Cache-Control directive are
# * considered uncacheable.
# *
# * Responses with neither a freshness lifetime (Expires, max-age) nor cache
# * validator (Last-Modified, ETag) are considered uncacheable because there is
# * no way to tell when or how to remove them from the cache.
# *
# * Note that RFC 7231 and RFC 7234 possibly allow for a more permissive implementation,
# * for example "status codes that are defined as cacheable by default [...]
# * can be reused by a cache with heuristic expiration unless otherwise indicated"
# * (https://tools.ietf.org/html/rfc7231#section-6.1)
# *
# * @final'
- name: isFresh
visibility: public
parameters: []
comment: '# * Returns true if the response is "fresh".
# *
# * Fresh responses may be served from cache without any interaction with the
# * origin. A response is considered fresh when it includes a Cache-Control/max-age
# * indicator or Expires header and the calculated age is less than the freshness
lifetime.
# *
# * @final'
- name: isValidateable
visibility: public
parameters: []
comment: '# * Returns true if the response includes headers that can be used to
validate
# * the response with the origin server using a conditional GET request.
# *
# * @final'
- name: setPrivate
visibility: public
parameters: []
comment: '# * Marks the response as "private".
# *
# * It makes the response ineligible for serving other clients.
# *
# * @return $this
# *
# * @final'
- name: setPublic
visibility: public
parameters: []
comment: '# * Marks the response as "public".
# *
# * It makes the response eligible for serving other clients.
# *
# * @return $this
# *
# * @final'
- name: setImmutable
visibility: public
parameters:
- name: immutable
default: 'true'
comment: '# * Marks the response as "immutable".
# *
# * @return $this
# *
# * @final'
- name: isImmutable
visibility: public
parameters: []
comment: '# * Returns true if the response is marked as "immutable".
# *
# * @final'
- name: mustRevalidate
visibility: public
parameters: []
comment: '# * Returns true if the response must be revalidated by shared caches
once it has become stale.
# *
# * This method indicates that the response must not be served stale by a
# * cache in any circumstance without first revalidating with the origin.
# * When present, the TTL of the response should not be overridden to be
# * greater than the value provided by the origin.
# *
# * @final'
- name: getDate
visibility: public
parameters: []
comment: '# * Returns the Date header as a DateTime instance.
# *
# * @throws \RuntimeException When the header is not parseable
# *
# * @final'
- name: setDate
visibility: public
parameters:
- name: date
comment: '# * Sets the Date header.
# *
# * @return $this
# *
# * @final'
- name: getAge
visibility: public
parameters: []
comment: '# * Returns the age of the response in seconds.
# *
# * @final'
- name: expire
visibility: public
parameters: []
comment: '# * Marks the response stale by setting the Age header to be equal to
the maximum age of the response.
# *
# * @return $this'
- name: getExpires
visibility: public
parameters: []
comment: '# * Returns the value of the Expires header as a DateTime instance.
# *
# * @final'
- name: setExpires
visibility: public
parameters:
- name: date
comment: '# * Sets the Expires HTTP header with a DateTime instance.
# *
# * Passing null as value will remove the header.
# *
# * @return $this
# *
# * @final'
- name: getMaxAge
visibility: public
parameters: []
comment: '# * Returns the number of seconds after the time specified in the response''s
Date
# * header when the response should no longer be considered fresh.
# *
# * First, it checks for a s-maxage directive, then a max-age directive, and then
it falls
# * back on an expires header. It returns null when no maximum age can be established.
# *
# * @final'
- name: setMaxAge
visibility: public
parameters:
- name: value
comment: '# * Sets the number of seconds after which the response should no longer
be considered fresh.
# *
# * This method sets the Cache-Control max-age directive.
# *
# * @return $this
# *
# * @final'
- name: setStaleIfError
visibility: public
parameters:
- name: value
comment: '# * Sets the number of seconds after which the response should no longer
be returned by shared caches when backend is down.
# *
# * This method sets the Cache-Control stale-if-error directive.
# *
# * @return $this
# *
# * @final'
- name: setStaleWhileRevalidate
visibility: public
parameters:
- name: value
comment: '# * Sets the number of seconds after which the response should no longer
return stale content by shared caches.
# *
# * This method sets the Cache-Control stale-while-revalidate directive.
# *
# * @return $this
# *
# * @final'
- name: setSharedMaxAge
visibility: public
parameters:
- name: value
comment: '# * Sets the number of seconds after which the response should no longer
be considered fresh by shared caches.
# *
# * This method sets the Cache-Control s-maxage directive.
# *
# * @return $this
# *
# * @final'
- name: getTtl
visibility: public
parameters: []
comment: '# * Returns the response''s time-to-live in seconds.
# *
# * It returns null when no freshness information is present in the response.
# *
# * When the response''s TTL is 0, the response may not be served from cache without
first
# * revalidating with the origin.
# *
# * @final'
- name: setTtl
visibility: public
parameters:
- name: seconds
comment: '# * Sets the response''s time-to-live for shared caches in seconds.
# *
# * This method adjusts the Cache-Control/s-maxage directive.
# *
# * @return $this
# *
# * @final'
- name: setClientTtl
visibility: public
parameters:
- name: seconds
comment: '# * Sets the response''s time-to-live for private/client caches in seconds.
# *
# * This method adjusts the Cache-Control/max-age directive.
# *
# * @return $this
# *
# * @final'
- name: getLastModified
visibility: public
parameters: []
comment: '# * Returns the Last-Modified HTTP header as a DateTime instance.
# *
# * @throws \RuntimeException When the HTTP header is not parseable
# *
# * @final'
- name: setLastModified
visibility: public
parameters:
- name: date
comment: '# * Sets the Last-Modified HTTP header with a DateTime instance.
# *
# * Passing null as value will remove the header.
# *
# * @return $this
# *
# * @final'
- name: getEtag
visibility: public
parameters: []
comment: '# * Returns the literal value of the ETag HTTP header.
# *
# * @final'
- name: setEtag
visibility: public
parameters:
- name: etag
- name: weak
default: 'false'
comment: '# * Sets the ETag value.
# *
# * @param string|null $etag The ETag unique identifier or null to remove the
header
# * @param bool $weak Whether you want a weak ETag or not
# *
# * @return $this
# *
# * @final'
- name: setCache
visibility: public
parameters:
- name: options
comment: '# * Sets the response''s cache headers (validation and/or expiration).
# *
# * Available options are: must_revalidate, no_cache, no_store, no_transform,
public, private, proxy_revalidate, max_age, s_maxage, immutable, last_modified
and etag.
# *
# * @return $this
# *
# * @throws \InvalidArgumentException
# *
# * @final'
- name: setNotModified
visibility: public
parameters: []
comment: '# * Modifies the response so that it conforms to the rules defined for
a 304 status code.
# *
# * This sets the status, removes the body, and discards any headers
# * that MUST NOT be included in 304 responses.
# *
# * @return $this
# *
# * @see https://tools.ietf.org/html/rfc2616#section-10.3.5
# *
# * @final'
- name: hasVary
visibility: public
parameters: []
comment: '# * Returns true if the response includes a Vary header.
# *
# * @final'
- name: getVary
visibility: public
parameters: []
comment: '# * Returns an array of header names given in the Vary header.
# *
# * @final'
- name: setVary
visibility: public
parameters:
- name: headers
- name: replace
default: 'true'
comment: '# * Sets the Vary header.
# *
# * @param bool $replace Whether to replace the actual value or not (true by default)
# *
# * @return $this
# *
# * @final'
- name: isNotModified
visibility: public
parameters:
- name: request
comment: '# * Determines if the Response validators (ETag, Last-Modified) match
# * a conditional value specified in the Request.
# *
# * If the Response is not modified, it sets the status code to 304 and
# * removes the actual content by calling the setNotModified() method.
# *
# * @final'
- name: isInvalid
visibility: public
parameters: []
comment: '# * Is response invalid?
# *
# * @see https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
# *
# * @final'
- name: isInformational
visibility: public
parameters: []
comment: '# * Is response informative?
# *
# * @final'
- name: isSuccessful
visibility: public
parameters: []
comment: '# * Is response successful?
# *
# * @final'
- name: isRedirection
visibility: public
parameters: []
comment: '# * Is the response a redirect?
# *
# * @final'
- name: isClientError
visibility: public
parameters: []
comment: '# * Is there a client error?
# *
# * @final'
- name: isServerError
visibility: public
parameters: []
comment: '# * Was there a server side error?
# *
# * @final'
- name: isOk
visibility: public
parameters: []
comment: '# * Is the response OK?
# *
# * @final'
- name: isForbidden
visibility: public
parameters: []
comment: '# * Is the response forbidden?
# *
# * @final'
- name: isNotFound
visibility: public
parameters: []
comment: '# * Is the response a not found error?
# *
# * @final'
- name: isRedirect
visibility: public
parameters:
- name: location
default: 'null'
comment: '# * Is the response a redirect of some form?
# *
# * @final'
- name: isEmpty
visibility: public
parameters: []
comment: '# * Is the response empty?
# *
# * @final'
- name: closeOutputBuffers
visibility: public
parameters:
- name: targetLevel
- name: flush
comment: '# * Cleans or flushes output buffers up to target level.
# *
# * Resulting level can be greater than target level if a non-removable buffer
has been encountered.
# *
# * @final'
- name: setContentSafe
visibility: public
parameters:
- name: safe
default: 'true'
comment: '# * Marks a response as safe according to RFC8674.
# *
# * @see https://tools.ietf.org/html/rfc8674'
- name: ensureIEOverSSLCompatibility
visibility: protected
parameters:
- name: request
comment: '# * Checks if we need to remove Cache-Control for SSL encrypted downloads
when using IE < 9.
# *
# * @see http://support.microsoft.com/kb/323308
# *
# * @final'
traits: []
interfaces: []