MediaWiki REL1_34
ResponseInterface.php
Go to the documentation of this file.
1<?php
2
31namespace MediaWiki\Rest;
32
33use Psr\Http\Message\StreamInterface;
34
40 // ResponseInterface
41
50 function getStatusCode();
51
65 function getReasonPhrase();
66
67 // ResponseInterface mutation
68
84 function setStatus( $code, $reasonPhrase = '' );
85
86 // MessageInterface
87
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
244
263 public function setCookie( $name, $value, $expire = 0, $options = [] );
264
276 public function getCookies();
277}
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: