43 lines
831 B
PHP
43 lines
831 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Uploads\Exceptions;
|
|
|
|
use RuntimeException;
|
|
|
|
final class DraftQuotaException extends RuntimeException
|
|
{
|
|
public function __construct(
|
|
private readonly string $machineCode,
|
|
private readonly int $httpStatus,
|
|
) {
|
|
parent::__construct($machineCode);
|
|
}
|
|
|
|
public function machineCode(): string
|
|
{
|
|
return $this->machineCode;
|
|
}
|
|
|
|
public function httpStatus(): int
|
|
{
|
|
return $this->httpStatus;
|
|
}
|
|
|
|
public static function draftLimit(): self
|
|
{
|
|
return new self('draft_limit', 429);
|
|
}
|
|
|
|
public static function storageLimit(): self
|
|
{
|
|
return new self('storage_limit', 413);
|
|
}
|
|
|
|
public static function duplicateUpload(): self
|
|
{
|
|
return new self('duplicate_upload', 422);
|
|
}
|
|
}
|