• File: OpenApiUnauthorizedResponse.php
  • Full Path: /var/www/html/back/app/Attributes/OpenApiUnauthorizedResponse.php
  • File size: 716 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 OpenApiUnauthorizedResponse extends ResponseAttribute
{
    public function __construct()
    {
    }

    public function toArray(): array
    {
        return [
            'status' => 401,
            'content' => ResponseService::array(Dto::unAuthorized()),
            'description' => 'Unauthorized',
        ];
    }
}