This commit is contained in:
2023-10-02 23:10:49 +03:00
commit c6cb488379
255 changed files with 18731 additions and 0 deletions
+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;
}
}