35 lines
774 B
PHP
35 lines
774 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Support\Ui\ActionSurface;
|
|
|
|
use App\Support\Ui\ActionSurface\Enums\ActionSurfaceSlot;
|
|
|
|
final class ActionSurfaceValidationIssue
|
|
{
|
|
public function __construct(
|
|
public readonly string $className,
|
|
public readonly string $message,
|
|
public readonly ?ActionSurfaceSlot $slot = null,
|
|
public readonly ?string $hint = null,
|
|
) {}
|
|
|
|
public function format(): string
|
|
{
|
|
$line = $this->className;
|
|
|
|
if ($this->slot !== null) {
|
|
$line .= ' ['.$this->slot->value.']';
|
|
}
|
|
|
|
$line .= ': '.$this->message;
|
|
|
|
if ($this->hint !== null && trim($this->hint) !== '') {
|
|
$line .= ' (hint: '.$this->hint.')';
|
|
}
|
|
|
|
return $line;
|
|
}
|
|
}
|