Core MVC, HTTP client, Session, Cookie, Config, HTTPException — 111 PHPUnit tests. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
40 lines
787 B
PHP
40 lines
787 B
PHP
<?php
|
|
/**
|
|
* @package Bicycle
|
|
* @author Egor Isaev
|
|
* @description Response.php
|
|
* @copyright (c) 03/06/2026
|
|
*/
|
|
|
|
namespace System\Classes;
|
|
|
|
class Response
|
|
{
|
|
private int $_status = 200;
|
|
private string $_body = '';
|
|
|
|
public function __construct(int $status = 200)
|
|
{
|
|
$this->_status = $status;
|
|
}
|
|
|
|
public function body(?string $content = null): string|static
|
|
{
|
|
if ($content === null) {
|
|
return $this->_body;
|
|
}
|
|
$this->_body = $content;
|
|
return $this;
|
|
}
|
|
|
|
public function status(?int $code = null): int|static
|
|
{
|
|
if ($code === null) {
|
|
return $this->_status;
|
|
}
|
|
$this->_status = $code;
|
|
http_response_code($code);
|
|
return $this;
|
|
}
|
|
}
|