init
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace Lucent\Schema;
|
||||
|
||||
final class Nullable
|
||||
{
|
||||
public function __construct(
|
||||
public bool $nullable,
|
||||
public mixed $value,
|
||||
public mixed $default,
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
public function value(): mixed
|
||||
{
|
||||
|
||||
if (!empty($this->value)) {
|
||||
return $this->value;
|
||||
}
|
||||
|
||||
if ($this->nullable) {
|
||||
return null;
|
||||
}
|
||||
return $this->default;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user