PluginProbe
Depicter — Popup & Slider Builder / trunk
Depicter — Popup & Slider Builder vtrunk
4.8.1 trunk 1.0.0 1.1.0 1.1.2 1.1.4 1.1.6 1.1.7 1.1.8 1.1.9 1.2.0 1.3.0 1.3.1 1.3.2 1.3.3 1.3.5 1.3.8 1.5.0 1.5.1 1.5.2 1.5.5 1.6.0 1.6.1 1.6.2 1.7.0 All 76 releases
depicter / modules / Psr / Http / Message / ResponseInterface.php

ResponseInterface.php in Depicter — Popup & Slider Builder trunk, at modules/Psr/Http/Message/ResponseInterface.php

71 lines 2.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 declare(strict_types=1);
4
5 namespace Depicter\Psr\Http\Message;
6
7 /**
8 * Representation of an outgoing, server-side response.
9 *
10 * Per the HTTP specification, this interface includes properties for
11 * each of the following:
12 *
13 * - Protocol version
14 * - Status code and reason phrase
15 * - Headers
16 * - Message body
17 *
18 * Responses are considered immutable; all methods that might change state MUST
19 * be implemented such that they retain the internal state of the current
20 * message and return an instance that contains the changed state.
21 */
22 interface ResponseInterface extends MessageInterface
23 {
24 /**
25 * Gets the response status code.
26 *
27 * The status code is a 3-digit integer result code of the server's attempt
28 * to understand and satisfy the request.
29 *
30 * @return int Status code.
31 */
32 public function getStatusCode();
33
34 /**
35 * Return an instance with the specified status code and, optionally, reason phrase.
36 *
37 * If no reason phrase is specified, implementations MAY choose to default
38 * to the RFC 7231 or IANA recommended reason phrase for the response's
39 * status code.
40 *
41 * This method MUST be implemented in such a way as to retain the
42 * immutability of the message, and MUST return an instance that has the
43 * updated status and reason phrase.
44 *
45 * @link http://tools.ietf.org/html/rfc7231#section-6
46 * @link http://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml
47 * @param int $code The 3-digit integer result code to set.
48 * @param string $reasonPhrase The reason phrase to use with the
49 * provided status code; if none is provided, implementations MAY
50 * use the defaults as suggested in the HTTP specification.
51 * @return static
52 * @throws \InvalidArgumentException For invalid status code arguments.
53 */
54 public function withStatus(int $code, string $reasonPhrase = '');
55
56 /**
57 * Gets the response reason phrase associated with the status code.
58 *
59 * Because a reason phrase is not a required element in a response
60 * status line, the reason phrase value MAY be null. Implementations MAY
61 * choose to return the default RFC 7231 recommended reason phrase (or those
62 * listed in the IANA HTTP Status Code Registry) for the response's
63 * status code.
64 *
65 * @link http://tools.ietf.org/html/rfc7231#section-6
66 * @link http://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml
67 * @return string Reason phrase; must return an empty string if none present.
68 */
69 public function getReasonPhrase();
70 }
71