This commit is contained in:
lexx committed 2023-10-02 23:10:49 +03:00
commit c6cb488379
255 files changed
+18731

No files matched your search

+42
View File
@@ -0,0 +1,42 @@
<?php
namespace Lucent\Field;
use JsonSerializable;
use Lucent\LucentException;
use Lucent\Validator\Validator;
class FieldName implements JsonSerializable
{
public string $value;
/**
* @throws LucentException
*/
function __construct(string $value)
{
Validator::single("Name", $value, "min:2|max:50|alpha_dash");
$this->value = $value;
}
public function value(): string
{
return $this->value;
}
public function equals(FieldName $name): bool
{
return $this->value === $name->value;
}
public function __toString(): string
{
return $this->value;
}
public function jsonSerialize(): string
{
return $this->value;
}
}