aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/sabre/http/lib/MessageInterface.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/sabre/http/lib/MessageInterface.php')
-rw-r--r--vendor/sabre/http/lib/MessageInterface.php73
1 files changed, 24 insertions, 49 deletions
diff --git a/vendor/sabre/http/lib/MessageInterface.php b/vendor/sabre/http/lib/MessageInterface.php
index df55beb2f..8070845d9 100644
--- a/vendor/sabre/http/lib/MessageInterface.php
+++ b/vendor/sabre/http/lib/MessageInterface.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\HTTP;
/**
@@ -10,8 +12,8 @@ namespace Sabre\HTTP;
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-interface MessageInterface {
-
+interface MessageInterface
+{
/**
* Returns the body as a readable stream resource.
*
@@ -20,7 +22,7 @@ interface MessageInterface {
*
* @return resource
*/
- function getBodyAsStream();
+ public function getBodyAsStream();
/**
* Returns the body as a string.
@@ -30,41 +32,35 @@ interface MessageInterface {
*
* @return string
*/
- function getBodyAsString();
+ public function getBodyAsString(): string;
/**
* Returns the message body, as it's internal representation.
*
- * This could be either a string or a stream.
+ * This could be either a string, a stream or a callback writing the body to php://output
*
- * @return resource|string
+ * @return resource|string|callable
*/
- function getBody();
+ public function getBody();
/**
* Updates the body resource with a new stream.
*
- * @param resource|string $body
- * @return void
+ * @param resource|string|callable $body
*/
- function setBody($body);
+ public function setBody($body);
/**
* Returns all the HTTP headers as an array.
*
* Every header is returned as an array, with one or more values.
- *
- * @return array
*/
- function getHeaders();
+ public function getHeaders(): array;
/**
* Will return true or false, depending on if a HTTP header exists.
- *
- * @param string $name
- * @return bool
*/
- function hasHeader($name);
+ public function hasHeader(string $name): bool;
/**
* Returns a specific HTTP header, based on it's name.
@@ -79,10 +75,9 @@ interface MessageInterface {
* `Set-Cookie` cannot be logically combined with a comma. In those cases
* you *should* use getHeaderAsArray().
*
- * @param string $name
* @return string|null
*/
- function getHeader($name);
+ public function getHeader(string $name);
/**
* Returns a HTTP header as an array.
@@ -92,10 +87,9 @@ interface MessageInterface {
*
* If the header did not exists, this method will return an empty array.
*
- * @param string $name
* @return string[]
*/
- function getHeaderAsArray($name);
+ public function getHeaderAsArray(string $name): array;
/**
* Updates a HTTP header.
@@ -104,11 +98,9 @@ interface MessageInterface {
*
* If the header already existed, it will be overwritten.
*
- * @param string $name
* @param string|string[] $value
- * @return void
*/
- function setHeader($name, $value);
+ public function setHeader(string $name, $value);
/**
* Sets a new set of HTTP headers.
@@ -117,11 +109,8 @@ interface MessageInterface {
* should be specified as either a string or an array.
*
* Any header that already existed will be overwritten.
- *
- * @param array $headers
- * @return void
*/
- function setHeaders(array $headers);
+ public function setHeaders(array $headers);
/**
* Adds a HTTP header.
@@ -130,21 +119,16 @@ interface MessageInterface {
* another value. Individual values can be retrieved with
* getHeadersAsArray.
*
- * @param string $name
- * @param string $value
- * @return void
+ * @param string|string[] $value
*/
- function addHeader($name, $value);
+ public function addHeader(string $name, $value);
/**
* Adds a new set of HTTP headers.
*
* Any existing headers will not be overwritten.
- *
- * @param array $headers
- * @return void
*/
- function addHeaders(array $headers);
+ public function addHeaders(array $headers);
/**
* Removes a HTTP header.
@@ -152,27 +136,18 @@ interface MessageInterface {
* The specified header name must be treated as case-insenstive.
* This method should return true if the header was successfully deleted,
* and false if the header did not exist.
- *
- * @param string $name
- * @return bool
*/
- function removeHeader($name);
+ public function removeHeader(string $name): bool;
/**
* Sets the HTTP version.
*
- * Should be 1.0 or 1.1.
- *
- * @param string $version
- * @return void
+ * Should be 1.0, 1.1 or 2.0.
*/
- function setHttpVersion($version);
+ public function setHttpVersion(string $version);
/**
* Returns the HTTP version.
- *
- * @return string
*/
- function getHttpVersion();
-
+ public function getHttpVersion(): string;
}