From c0dc531ebefd8912819f3b6c8bda1fed3c7e750c Mon Sep 17 00:00:00 2001 From: Evgeny Zinoviev Date: Wed, 31 Jan 2024 06:11:00 +0300 Subject: make it simple, but not simpler --- skin/error.skin.php | 27 +++++---------------------- 1 file changed, 5 insertions(+), 22 deletions(-) (limited to 'skin/error.skin.php') diff --git a/skin/error.skin.php b/skin/error.skin.php index 5276bfa..8f7e4c7 100644 --- a/skin/error.skin.php +++ b/skin/error.skin.php @@ -4,34 +4,17 @@ namespace skin\error; use Stringable; -function forbidden($ctx, $message) { - return $ctx->common(403, 'Forbidden', $message); -} - -function not_found($ctx, $message) { - return $ctx->common(404, 'Not Found', $message); -} - -function unauthorized($ctx, $message) { - return $ctx->common(401, 'Unauthorized', $message); -} - -function not_implemented($ctx, $message) { - return $ctx->common(501, 'Not Implemented', $message); -} - -function common($ctx, - int $code, - string|Stringable $title, - string|Stringable|null $message = null) { +function http_error($ctx, + int $code, + string|Stringable $title, + string|Stringable|null $message = null) { return << $code $title

$code $title

-
{$ctx->if_true($message, - '

'.$message.'

' + '

'.$message.'

' )} -- cgit v1.2.3