Mahdee Rajon
File "OpenApiNotFoundResponse.php"
Full Path: /var/www/html/back/app/Attributes/OpenApiNotFoundResponse.php
File size: 750 bytes
MIME-type: text/x-php
Charset: utf-8
<?php
declare(strict_types=1);
namespace App\Attributes;
use AllowDynamicProperties;
use App\Responses\Shared\Dto;
use App\Services\Shared\ResponseService;
use Attribute;
use Knuckles\Scribe\Attributes\Response as ResponseAttribute;
#[AllowDynamicProperties]
#[Attribute(Attribute::IS_REPEATABLE | Attribute::TARGET_FUNCTION | Attribute::TARGET_METHOD | Attribute::TARGET_CLASS)]
class OpenApiNotFoundResponse extends ResponseAttribute
{
public function __construct(
public ?string $class,
) {
}
public function toArray(): array
{
return [
'status' => 404,
'content' => ResponseService::array(Dto::notFound($this->class)),
'description' => 'Not Found',
];
}
}