CoreFiles by mySites.guru
EmptyResponse.php36 lines, 948 bytes, from Joomla_6.2.0-beta2-Beta-Full_Package.zip
Raw History Compare with 6.2.0-beta1
md5
a8128fff8029b8defaa8a2dbb6282c05
sha1
1e61821ea72e3223be1804919df3d733974624a2
sha256
71f10a48c57875f67512f0a9ae266ef5e9cffc6c5dc93006640a15eeff426154
<?php

declare(strict_types=1);

namespace Laminas\Diactoros\Response;

use Laminas\Diactoros\Response;
use Laminas\Diactoros\Stream;

/**
 * A class representing empty HTTP responses.
 */
class EmptyResponse extends Response
{
    /**
     * Create an empty response with the given status code.
     *
     * @param int $status Status code for the response, if any.
     * @param array<non-empty-string, string|string[]> $headers Headers for the response, if any.
     */
    public function __construct(int $status = 204, array $headers = [])
    {
        $body = new Stream('php://temp', 'r');
        parent::__construct($body, $status, $headers);
    }

    /**
     * Create an empty response with the given headers.
     *
     * @param array<non-empty-string, string[]> $headers Headers for the response.
     */
    public static function withHeaders(array $headers): EmptyResponse
    {
        return new static(204, $headers);
    }
}

The same content is in 32 releases, Joomla 6.1.0-alpha2 to 6.3.0-alpha1. See them all, or every version of this file.