CoreFiles by mySites.guru
EmptyResponse.php43 lines, 1,201 bytes, from Joomla_4.2.4-Stable-Full_Package.zip
Raw History Compare with 4.2.3
md5
bcc6e1de2f219ba7221dc47857c92440
sha1
5174cc8985216dc0c23aed696ff4033390e086da
sha256
b704faf97e0a93a430fd4ab02af223f54e836ddf778c95976ee83aeb01de01e2
<?php

/**
 * @see       https://github.com/laminas/laminas-diactoros for the canonical source repository
 * @copyright https://github.com/laminas/laminas-diactoros/blob/master/COPYRIGHT.md
 * @license   https://github.com/laminas/laminas-diactoros/blob/master/LICENSE.md New BSD License
 */

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.
     * @return EmptyResponse
     */
    public static function withHeaders(array $headers) : EmptyResponse
    {
        return new static(204, $headers);
    }
}

The same content is in 131 releases, Joomla 4.0.0-beta to 4.4.14. See them all, or every version of this file.