|
|
@@ -518,7 +518,7 @@ class Response implements ResponseInterface
|
|
|
* @param string $url The location to redirect to.
|
|
|
* @return static A new response with the Location header set.
|
|
|
*/
|
|
|
- public function withLocation(string $url): self
|
|
|
+ public function withLocation(string $url)
|
|
|
{
|
|
|
$new = $this->withHeader('Location', $url);
|
|
|
if ($new->_status === 200) {
|
|
|
@@ -680,7 +680,7 @@ class Response implements ResponseInterface
|
|
|
* @param string $contentType Either a file extension which will be mapped to a mime-type or a concrete mime-type.
|
|
|
* @return static
|
|
|
*/
|
|
|
- public function withType(string $contentType): self
|
|
|
+ public function withType(string $contentType)
|
|
|
{
|
|
|
$mappedType = $this->resolveType($contentType);
|
|
|
$new = clone $this;
|
|
|
@@ -766,7 +766,7 @@ class Response implements ResponseInterface
|
|
|
* @param string $charset Character set string.
|
|
|
* @return static
|
|
|
*/
|
|
|
- public function withCharset(string $charset): self
|
|
|
+ public function withCharset(string $charset)
|
|
|
{
|
|
|
$new = clone $this;
|
|
|
$new->_charset = $charset;
|
|
|
@@ -780,7 +780,7 @@ class Response implements ResponseInterface
|
|
|
*
|
|
|
* @return static
|
|
|
*/
|
|
|
- public function withDisabledCache(): self
|
|
|
+ public function withDisabledCache()
|
|
|
{
|
|
|
return $this->withHeader('Expires', 'Mon, 26 Jul 1997 05:00:00 GMT')
|
|
|
->withHeader('Last-Modified', gmdate('D, d M Y H:i:s') . ' GMT')
|
|
|
@@ -794,7 +794,7 @@ class Response implements ResponseInterface
|
|
|
* @param int|string $time a valid time for cache expiry
|
|
|
* @return static
|
|
|
*/
|
|
|
- public function withCache($since, $time = '+1 day'): self
|
|
|
+ public function withCache($since, $time = '+1 day')
|
|
|
{
|
|
|
if (!is_int($time)) {
|
|
|
$time = strtotime($time);
|
|
|
@@ -815,7 +815,7 @@ class Response implements ResponseInterface
|
|
|
* @param int|null $time time in seconds after which the response should no longer be considered fresh.
|
|
|
* @return static
|
|
|
*/
|
|
|
- public function withSharable(bool $public, ?int $time = null): self
|
|
|
+ public function withSharable(bool $public, ?int $time = null)
|
|
|
{
|
|
|
$new = clone $this;
|
|
|
unset($new->_cacheDirectives['private'], $new->_cacheDirectives['public']);
|
|
|
@@ -840,7 +840,7 @@ class Response implements ResponseInterface
|
|
|
* @param int $seconds The number of seconds for shared max-age
|
|
|
* @return static
|
|
|
*/
|
|
|
- public function withSharedMaxAge(int $seconds): self
|
|
|
+ public function withSharedMaxAge(int $seconds)
|
|
|
{
|
|
|
$new = clone $this;
|
|
|
$new->_cacheDirectives['s-maxage'] = $seconds;
|
|
|
@@ -858,7 +858,7 @@ class Response implements ResponseInterface
|
|
|
* @param int $seconds The seconds a cached response can be considered valid
|
|
|
* @return static
|
|
|
*/
|
|
|
- public function withMaxAge(int $seconds): self
|
|
|
+ public function withMaxAge(int $seconds)
|
|
|
{
|
|
|
$new = clone $this;
|
|
|
$new->_cacheDirectives['max-age'] = $seconds;
|
|
|
@@ -878,7 +878,7 @@ class Response implements ResponseInterface
|
|
|
* @param bool $enable If boolean sets or unsets the directive.
|
|
|
* @return static
|
|
|
*/
|
|
|
- public function withMustRevalidate(bool $enable): self
|
|
|
+ public function withMustRevalidate(bool $enable)
|
|
|
{
|
|
|
$new = clone $this;
|
|
|
if ($enable) {
|
|
|
@@ -924,7 +924,7 @@ class Response implements ResponseInterface
|
|
|
* @param string|\DateTimeInterface $time Valid time string or \DateTime instance.
|
|
|
* @return static
|
|
|
*/
|
|
|
- public function withExpires($time): self
|
|
|
+ public function withExpires($time)
|
|
|
{
|
|
|
$date = $this->_getUTCDate($time);
|
|
|
|
|
|
@@ -947,7 +947,7 @@ class Response implements ResponseInterface
|
|
|
* @param int|string|\DateTimeInterface $time Valid time string or \DateTime instance.
|
|
|
* @return static
|
|
|
*/
|
|
|
- public function withModified($time): self
|
|
|
+ public function withModified($time)
|
|
|
{
|
|
|
$date = $this->_getUTCDate($time);
|
|
|
|
|
|
@@ -991,7 +991,7 @@ class Response implements ResponseInterface
|
|
|
*
|
|
|
* @return static
|
|
|
*/
|
|
|
- public function withNotModified(): self
|
|
|
+ public function withNotModified()
|
|
|
{
|
|
|
$new = $this->withStatus(304);
|
|
|
$new->_createStream();
|
|
|
@@ -1022,7 +1022,7 @@ class Response implements ResponseInterface
|
|
|
* containing the list for variances.
|
|
|
* @return static
|
|
|
*/
|
|
|
- public function withVary($cacheVariances): self
|
|
|
+ public function withVary($cacheVariances)
|
|
|
{
|
|
|
return $this->withHeader('Vary', (array)$cacheVariances);
|
|
|
}
|
|
|
@@ -1048,7 +1048,7 @@ class Response implements ResponseInterface
|
|
|
* other with the same hash or not. Defaults to false
|
|
|
* @return static
|
|
|
*/
|
|
|
- public function withEtag(string $hash, bool $weak = false): self
|
|
|
+ public function withEtag(string $hash, bool $weak = false)
|
|
|
{
|
|
|
$hash = sprintf('%s"%s"', $weak ? 'W/' : null, $hash);
|
|
|
|
|
|
@@ -1108,7 +1108,7 @@ class Response implements ResponseInterface
|
|
|
* @param string $filename The name of the file as the browser will download the response
|
|
|
* @return static
|
|
|
*/
|
|
|
- public function withDownload(string $filename): self
|
|
|
+ public function withDownload(string $filename)
|
|
|
{
|
|
|
return $this->withHeader('Content-Disposition', 'attachment; filename="' . $filename . '"');
|
|
|
}
|
|
|
@@ -1119,7 +1119,7 @@ class Response implements ResponseInterface
|
|
|
* @param int|string $bytes Number of bytes
|
|
|
* @return static
|
|
|
*/
|
|
|
- public function withLength($bytes): self
|
|
|
+ public function withLength($bytes)
|
|
|
{
|
|
|
return $this->withHeader('Content-Length', (string)$bytes);
|
|
|
}
|
|
|
@@ -1146,7 +1146,7 @@ class Response implements ResponseInterface
|
|
|
* @return static
|
|
|
* @since 3.6.0
|
|
|
*/
|
|
|
- public function withAddedLink(string $url, array $options = []): self
|
|
|
+ public function withAddedLink(string $url, array $options = [])
|
|
|
{
|
|
|
$params = [];
|
|
|
foreach ($options as $key => $option) {
|
|
|
@@ -1228,7 +1228,7 @@ class Response implements ResponseInterface
|
|
|
* @param \Cake\Http\Cookie\CookieInterface $cookie cookie object
|
|
|
* @return static
|
|
|
*/
|
|
|
- public function withCookie(CookieInterface $cookie): self
|
|
|
+ public function withCookie(CookieInterface $cookie)
|
|
|
{
|
|
|
$new = clone $this;
|
|
|
$new->_cookies = $new->_cookies->add($cookie);
|
|
|
@@ -1249,7 +1249,7 @@ class Response implements ResponseInterface
|
|
|
* @param \Cake\Http\Cookie\CookieInterface $cookie cookie object
|
|
|
* @return static
|
|
|
*/
|
|
|
- public function withExpiredCookie(CookieInterface $cookie): self
|
|
|
+ public function withExpiredCookie(CookieInterface $cookie)
|
|
|
{
|
|
|
$cookie = $cookie->withExpired();
|
|
|
|
|
|
@@ -1406,7 +1406,7 @@ class Response implements ResponseInterface
|
|
|
* @return static
|
|
|
* @throws \Cake\Http\Exception\NotFoundException
|
|
|
*/
|
|
|
- public function withFile(string $path, array $options = []): self
|
|
|
+ public function withFile(string $path, array $options = [])
|
|
|
{
|
|
|
$file = $this->validateFile($path);
|
|
|
$options += [
|
|
|
@@ -1462,7 +1462,7 @@ class Response implements ResponseInterface
|
|
|
* @param string $string The string to be sent
|
|
|
* @return static
|
|
|
*/
|
|
|
- public function withStringBody(?string $string): self
|
|
|
+ public function withStringBody(?string $string)
|
|
|
{
|
|
|
$new = clone $this;
|
|
|
$new->_createStream();
|