diff options
Diffstat (limited to 'vendor/sabre/http/lib/MessageDecoratorTrait.php')
-rw-r--r-- | vendor/sabre/http/lib/MessageDecoratorTrait.php | 117 |
1 files changed, 37 insertions, 80 deletions
diff --git a/vendor/sabre/http/lib/MessageDecoratorTrait.php b/vendor/sabre/http/lib/MessageDecoratorTrait.php index 1cb32da22..d5504ac78 100644 --- a/vendor/sabre/http/lib/MessageDecoratorTrait.php +++ b/vendor/sabre/http/lib/MessageDecoratorTrait.php @@ -1,5 +1,7 @@ <?php +declare(strict_types=1); + namespace Sabre\HTTP; /** @@ -13,8 +15,8 @@ namespace Sabre\HTTP; * @author Evert Pot (http://evertpot.com/) * @license http://sabre.io/license/ Modified BSD License */ -trait MessageDecoratorTrait { - +trait MessageDecoratorTrait +{ /** * The inner request object. * @@ -32,10 +34,9 @@ trait MessageDecoratorTrait { * * @return resource */ - function getBodyAsStream() { - + public function getBodyAsStream() + { return $this->inner->getBodyAsStream(); - } /** @@ -43,13 +44,10 @@ trait MessageDecoratorTrait { * * Note that because the underlying data may be based on a stream, this * method could only work correctly the first time. - * - * @return string */ - function getBodyAsString() { - + public function getBodyAsString(): string + { return $this->inner->getBodyAsString(); - } /** @@ -59,47 +57,37 @@ trait MessageDecoratorTrait { * * @return resource|string */ - function getBody() { - + public function getBody() + { return $this->inner->getBody(); - } /** * Updates the body resource with a new stream. * - * @param resource $body - * @return void + * @param resource|string|callable $body */ - function setBody($body) { - + public function setBody($body) + { $this->inner->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 + { return $this->inner->getHeaders(); - } /** * 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 + { return $this->inner->hasHeader($name); - } /** @@ -115,13 +103,11 @@ trait MessageDecoratorTrait { * `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) + { return $this->inner->getHeader($name); - } /** @@ -131,14 +117,10 @@ trait MessageDecoratorTrait { * item will appear in the array. * * 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 + { return $this->inner->getHeaderAsArray($name); - } /** @@ -148,14 +130,11 @@ trait MessageDecoratorTrait { * * 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) + { $this->inner->setHeader($name, $value); - } /** @@ -165,14 +144,10 @@ trait MessageDecoratorTrait { * 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) + { $this->inner->setHeaders($headers); - } /** @@ -182,31 +157,23 @@ trait MessageDecoratorTrait { * 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) + { $this->inner->addHeader($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) + { $this->inner->addHeaders($headers); - } - /** * Removes a HTTP header. * @@ -214,38 +181,28 @@ trait MessageDecoratorTrait { * 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 + { return $this->inner->removeHeader($name); - } /** * 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) + { $this->inner->setHttpVersion($version); - } /** * Returns the HTTP version. - * - * @return string */ - function getHttpVersion() { - + public function getHttpVersion(): string + { return $this->inner->getHttpVersion(); - } - } |