Bicycle/System/Classes/HTTP/Exception/HTTPException_403.php
Egor Isaev b65603b4d0 dev
2026-06-23 10:44:18 +03:00

44 lines
995 B
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
/**
* @package Bicycle
* @author Egor Isaev
* @description HTTPException_403.php
* @copyright (c) 04/06/2026
*/
namespace System\Classes\HTTP\Exception;
use System\Classes\Core;
use System\Classes\HTTP\HTTPException;
use System\Classes\Response;
/**
* 403 Forbidden: рендерит шаблон view/errors/403.html.
*/
class HTTPException_403 extends HTTPException
{
/** @var int HTTP-код */
protected int $_code = 403;
/**
* Формирует Response 403 с телом из шаблона ошибки.
*
* @return Response
*/
public function getResponse(): Response
{
http_response_code(403);
$response = new Response(403);
$view = Core::findFile('view/errors', '403', 'html');
if ($view) {
ob_start();
$message = $this->getMessage();
include $view;
$response->body(ob_get_clean());
}
return $response;
}
}