22 lines
767 B
PHP
22 lines
767 B
PHP
<?php
|
|
|
|
namespace App\Rules;
|
|
|
|
use App\Actions\Tickets\Support\TicketDescriptionFormat;
|
|
use Closure;
|
|
use Illuminate\Contracts\Validation\ValidationRule;
|
|
|
|
class VisualTicketDescription implements ValidationRule
|
|
{
|
|
public function validate(string $attribute, mixed $value, Closure $fail): void
|
|
{
|
|
if (! is_string($value)) {
|
|
return;
|
|
}
|
|
$unsupported = TicketDescriptionFormat::unsupportedContent($value);
|
|
if ($unsupported !== []) {
|
|
$fail('The description contains unsupported '.implode(', ', $unsupported).'. Remove these contents or show literal examples inside code. Use ordinary Markdown and safe links; put acceptance criteria only in acceptance_criteria. No ticket fields were changed.');
|
|
}
|
|
}
|
|
}
|