MediaWiki  1.34.0
ResponseInterface.php
Go to the documentation of this file.
1 <?php
2 
31 namespace MediaWiki\Rest;
32 
33 use Psr\Http\Message\StreamInterface;
34 
39 interface ResponseInterface {
40  // ResponseInterface
41 
50  function getStatusCode();
51 
65  function getReasonPhrase();
66 
67  // ResponseInterface mutation
68 
84  function setStatus( $code, $reasonPhrase = '' );
85 
86  // MessageInterface
87 
95  function getProtocolVersion();
96 
122  function getHeaders();
123 
132  function hasHeader( $name );
133 
148  function getHeader( $name );
149 
169  function getHeaderLine( $name );
170 
176  function getBody();
177 
178  // MessageInterface mutation
179 
188  function setProtocolVersion( $version );
189 
200  function setHeader( $name, $value );
201 
214  function addHeader( $name, $value );
215 
223  function removeHeader( $name );
224 
233  function setBody( StreamInterface $body );
234 
235  // MediaWiki extensions to PSR-7
236 
243  function getRawHeaderLines();
244 
263  public function setCookie( $name, $value, $expire = 0, $options = [] );
264 
276  public function getCookies();
277 }
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:39
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.