. */ declare(strict_types=1); namespace Fisharebest\Webtrees\Elements; use Fisharebest\Webtrees\Registry; use Fisharebest\Webtrees\Tree; /** * UID fields */ class Uid extends AbstractElement { protected const int MAXIMUM_LENGTH = 36; /** * Create a default value for this element. * * @param Tree $tree * * @return string */ public function default(Tree $tree): string { if ($tree->getPreference('GENERATE_UIDS') === '1') { return Registry::idFactory()->uuid(); } return ''; } }