Verzeichnisstruktur phpBB-3.3.15


Veröffentlicht
28.08.2024

So funktioniert es


Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück

Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis.
Auf den Verzeichnisnamen klicken, dies zeigt nur das Verzeichnis mit Inhalt an

(Beispiel Datei-Icons)

Auf das Icon klicken um den Quellcode anzuzeigen

MessageInterface.php

Zuletzt modifiziert: 02.04.2025, 15:03 - Dateigröße: 6.82 KiB


001  <?php
002   
003  declare(strict_types=1);
004   
005  namespace Psr\Http\Message;
006   
007  /**
008   * HTTP messages consist of requests from a client to a server and responses
009   * from a server to a client. This interface defines the methods common to
010   * each.
011   *
012   * Messages are considered immutable; all methods that might change state MUST
013   * be implemented such that they retain the internal state of the current
014   * message and return an instance that contains the changed state.
015   *
016   * @link http://www.ietf.org/rfc/rfc7230.txt
017   * @link http://www.ietf.org/rfc/rfc7231.txt
018   */
019  interface MessageInterface
020  {
021      /**
022       * Retrieves the HTTP protocol version as a string.
023       *
024       * The string MUST contain only the HTTP version number (e.g., "1.1", "1.0").
025       *
026       * @return string HTTP protocol version.
027       */
028      public function getProtocolVersion();
029   
030      /**
031       * Return an instance with the specified HTTP protocol version.
032       *
033       * The version string MUST contain only the HTTP version number (e.g.,
034       * "1.1", "1.0").
035       *
036       * This method MUST be implemented in such a way as to retain the
037       * immutability of the message, and MUST return an instance that has the
038       * new protocol version.
039       *
040       * @param string $version HTTP protocol version
041       * @return static
042       */
043      public function withProtocolVersion(string $version);
044   
045      /**
046       * Retrieves all message header values.
047       *
048       * The keys represent the header name as it will be sent over the wire, and
049       * each value is an array of strings associated with the header.
050       *
051       *     // Represent the headers as a string
052       *     foreach ($message->getHeaders() as $name => $values) {
053       *         echo $name . ": " . implode(", ", $values);
054       *     }
055       *
056       *     // Emit headers iteratively:
057       *     foreach ($message->getHeaders() as $name => $values) {
058       *         foreach ($values as $value) {
059       *             header(sprintf('%s: %s', $name, $value), false);
060       *         }
061       *     }
062       *
063       * While header names are not case-sensitive, getHeaders() will preserve the
064       * exact case in which headers were originally specified.
065       *
066       * @return string[][] Returns an associative array of the message's headers. Each
067       *     key MUST be a header name, and each value MUST be an array of strings
068       *     for that header.
069       */
070      public function getHeaders();
071   
072      /**
073       * Checks if a header exists by the given case-insensitive name.
074       *
075       * @param string $name Case-insensitive header field name.
076       * @return bool Returns true if any header names match the given header
077       *     name using a case-insensitive string comparison. Returns false if
078       *     no matching header name is found in the message.
079       */
080      public function hasHeader(string $name);
081   
082      /**
083       * Retrieves a message header value by the given case-insensitive name.
084       *
085       * This method returns an array of all the header values of the given
086       * case-insensitive header name.
087       *
088       * If the header does not appear in the message, this method MUST return an
089       * empty array.
090       *
091       * @param string $name Case-insensitive header field name.
092       * @return string[] An array of string values as provided for the given
093       *    header. If the header does not appear in the message, this method MUST
094       *    return an empty array.
095       */
096      public function getHeader(string $name);
097   
098      /**
099       * Retrieves a comma-separated string of the values for a single header.
100       *
101       * This method returns all of the header values of the given
102       * case-insensitive header name as a string concatenated together using
103       * a comma.
104       *
105       * NOTE: Not all header values may be appropriately represented using
106       * comma concatenation. For such headers, use getHeader() instead
107       * and supply your own delimiter when concatenating.
108       *
109       * If the header does not appear in the message, this method MUST return
110       * an empty string.
111       *
112       * @param string $name Case-insensitive header field name.
113       * @return string A string of values as provided for the given header
114       *    concatenated together using a comma. If the header does not appear in
115       *    the message, this method MUST return an empty string.
116       */
117      public function getHeaderLine(string $name);
118   
119      /**
120       * Return an instance with the provided value replacing the specified header.
121       *
122       * While header names are case-insensitive, the casing of the header will
123       * be preserved by this function, and returned from getHeaders().
124       *
125       * This method MUST be implemented in such a way as to retain the
126       * immutability of the message, and MUST return an instance that has the
127       * new and/or updated header and value.
128       *
129       * @param string $name Case-insensitive header field name.
130       * @param string|string[] $value Header value(s).
131       * @return static
132       * @throws \InvalidArgumentException for invalid header names or values.
133       */
134      public function withHeader(string $name, $value);
135   
136      /**
137       * Return an instance with the specified header appended with the given value.
138       *
139       * Existing values for the specified header will be maintained. The new
140       * value(s) will be appended to the existing list. If the header did not
141       * exist previously, it will be added.
142       *
143       * This method MUST be implemented in such a way as to retain the
144       * immutability of the message, and MUST return an instance that has the
145       * new header and/or value.
146       *
147       * @param string $name Case-insensitive header field name to add.
148       * @param string|string[] $value Header value(s).
149       * @return static
150       * @throws \InvalidArgumentException for invalid header names or values.
151       */
152      public function withAddedHeader(string $name, $value);
153   
154      /**
155       * Return an instance without the specified header.
156       *
157       * Header resolution MUST be done without case-sensitivity.
158       *
159       * This method MUST be implemented in such a way as to retain the
160       * immutability of the message, and MUST return an instance that removes
161       * the named header.
162       *
163       * @param string $name Case-insensitive header field name to remove.
164       * @return static
165       */
166      public function withoutHeader(string $name);
167   
168      /**
169       * Gets the body of the message.
170       *
171       * @return StreamInterface Returns the body as a stream.
172       */
173      public function getBody();
174   
175      /**
176       * Return an instance with the specified message body.
177       *
178       * The body MUST be a StreamInterface object.
179       *
180       * This method MUST be implemented in such a way as to retain the
181       * immutability of the message, and MUST return a new instance that has the
182       * new body stream.
183       *
184       * @param StreamInterface $body Body.
185       * @return static
186       * @throws \InvalidArgumentException When the body is not valid.
187       */
188      public function withBody(StreamInterface $body);
189  }
190