. */ declare(strict_types=1); namespace Fisharebest\Webtrees\Elements; use Fisharebest\Webtrees\I18N; use Fisharebest\Webtrees\Registry; use Fisharebest\Webtrees\Tree; use function strtoupper; /** * _UID fields, as created by PAF and other applications */ class PafUid extends AbstractElement { protected const int MAXIMUM_LENGTH = 36; public function canonical(string $value): string { $value = parent::canonical($value); if (preg_match('/([0-9a-f]{8})-?([0-9a-f]{4})-?([0-9a-f]{4})-?([0-9a-f]{4})-?([0-9a-f]{12})/i', $value, $match) === 1) { $value = strtoupper($match[1] . $match[2] . $match [3] . $match[4] . $match[5]); return $value . Registry::idFactory()->pafUidChecksum($value); } return Registry::idFactory()->pafUid(); } public function edit(string $id, string $name, string $value, Tree $tree): string { return '
' . parent::edit($id, $name, $value, $tree) . '' . '
' . ''; } }