MediaWiki REL1_35
ResponseInterface.php
Go to the documentation of this file.
1<?php
2
31namespace MediaWiki\Rest;
32
33use Psr\Http\Message\StreamInterface;
34
42 // ResponseInterface
43
52 public function getStatusCode();
53
67 public function getReasonPhrase();
68
69 // ResponseInterface mutation
70
86 public function setStatus( $code, $reasonPhrase = '' );
87
88 // MessageInterface
89
97 public function getProtocolVersion();
98
124 public function getHeaders();
125
134 public function hasHeader( $name );
135
150 public function getHeader( $name );
151
171 public function getHeaderLine( $name );
172
178 public function getBody();
179
180 // MessageInterface mutation
181
190 public function setProtocolVersion( $version );
191
202 public function setHeader( $name, $value );
203
216 public function addHeader( $name, $value );
217
225 public function removeHeader( $name );
226
235 public function setBody( StreamInterface $body );
236
237 // MediaWiki extensions to PSR-7
238
245 public function getRawHeaderLines();
246
265 public function setCookie( $name, $value, $expire = 0, $options = [] );
266
279 public function getCookies();
280}
An interface similar to PSR-7's ResponseInterface, the primary difference being that it is mutable.
setHeader( $name, $value)
Set or replace the specified header.
setProtocolVersion( $version)
Set the HTTP protocol version.
addHeader( $name, $value)
Append the given value to the specified header.
setBody(StreamInterface $body)
Set the message body.
getReasonPhrase()
Gets the response reason phrase associated with the status code.
getRawHeaderLines()
Get the full header lines including colon-separated name and value, for passing directly to header().
getHeader( $name)
Retrieves a message header value by the given case-insensitive name.
getHeaders()
Retrieves all message header values.
hasHeader( $name)
Checks if a header exists by the given case-insensitive name.
getBody()
Gets the body of the message.
getProtocolVersion()
Retrieves the HTTP protocol version as a string.
setStatus( $code, $reasonPhrase='')
Set the status code and, optionally, reason phrase.
setCookie( $name, $value, $expire=0, $options=[])
Set a cookie.
getHeaderLine( $name)
Retrieves a comma-separated string of the values for a single header.
getStatusCode()
Gets the response status code.
removeHeader( $name)
Remove the specified header.
getCookies()
Get all previously set cookies as a list of associative arrays with the following keys: