MediaWiki  master
ResponseInterface.php
Go to the documentation of this file.
1 <?php
2 
31 namespace MediaWiki\Rest;
32 
33 use Psr\Http\Message\StreamInterface;
34 
41 interface ResponseInterface {
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 }
MediaWiki\Rest\ResponseInterface\getReasonPhrase
getReasonPhrase()
Gets the response reason phrase associated with the status code.
MediaWiki\Rest\ResponseInterface\getHeader
getHeader( $name)
Retrieves a message header value by the given case-insensitive name.
MediaWiki\Rest\ResponseInterface\removeHeader
removeHeader( $name)
Remove the specified header.
MediaWiki\Rest\ResponseInterface\hasHeader
hasHeader( $name)
Checks if a header exists by the given case-insensitive name.
MediaWiki\Rest\ResponseInterface\getStatusCode
getStatusCode()
Gets the response status code.
MediaWiki\Rest\ResponseInterface\getRawHeaderLines
getRawHeaderLines()
Get the full header lines including colon-separated name and value, for passing directly to header().
MediaWiki\Rest\ResponseInterface\setCookie
setCookie( $name, $value, $expire=0, $options=[])
Set a cookie.
MediaWiki\Rest\ResponseInterface\setHeader
setHeader( $name, $value)
Set or replace the specified header.
MediaWiki\Rest\ResponseInterface\setProtocolVersion
setProtocolVersion( $version)
Set the HTTP protocol version.
MediaWiki\Rest\ResponseInterface\getBody
getBody()
Gets the body of the message.
MediaWiki\Rest
MediaWiki\Rest\ResponseInterface
An interface similar to PSR-7's ResponseInterface, the primary difference being that it is mutable.
Definition: ResponseInterface.php:41
MediaWiki\Rest\ResponseInterface\getCookies
getCookies()
Get all previously set cookies as a list of associative arrays with the following keys:
MediaWiki\Rest\ResponseInterface\getHeaderLine
getHeaderLine( $name)
Retrieves a comma-separated string of the values for a single header.
MediaWiki\Rest\ResponseInterface\getProtocolVersion
getProtocolVersion()
Retrieves the HTTP protocol version as a string.
MediaWiki\Rest\ResponseInterface\addHeader
addHeader( $name, $value)
Append the given value to the specified header.
MediaWiki\Rest\ResponseInterface\setBody
setBody(StreamInterface $body)
Set the message body.
MediaWiki\Rest\ResponseInterface\getHeaders
getHeaders()
Retrieves all message header values.
MediaWiki\Rest\ResponseInterface\setStatus
setStatus( $code, $reasonPhrase='')
Set the status code and, optionally, reason phrase.