CoreFiles by mySites.guru
EmptyResponse.php36 lines, 885 bytes, from Joomla_5.4.4-Stable-Full_Package.zip
Raw History Compare with 5.4.3
md5
6f7d279b69dfd6d34ea488185fcf6c6d
sha1
3dbeedd8b5a919ea30474fb0339f337ed6de5b3c
sha256
54e65c4f835e0f18e95b78b9daebc9647cdd0be6ddb77c72c175c11c6a4d6983
<?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 $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 $headers Headers for the response.
     */
    public static function withHeaders(array $headers): EmptyResponse
    {
        return new static(204, $headers);
    }
}

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