init
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace Lucent\Channel;
|
||||
|
||||
|
||||
use Lucent\Validator\Validator;
|
||||
|
||||
class PreviewTarget
|
||||
{
|
||||
function __construct(
|
||||
public readonly string $label,
|
||||
public readonly string $url,
|
||||
)
|
||||
{
|
||||
Validator::single("label", $label, "required|min:2|max:50");
|
||||
Validator::single("url", $url, "required|url");
|
||||
}
|
||||
|
||||
public static function fromArray(array $data): PreviewTarget
|
||||
{
|
||||
|
||||
return new PreviewTarget(
|
||||
label: $data["label"],
|
||||
url: $data["url"],
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user