. */ declare(strict_types=1); namespace Fisharebest\Webtrees\Elements; use Fisharebest\Webtrees\Tree; use function e; use function rawurlencode; use function strtoupper; /** * ANCESTRAL_FILE_NUMBER := {Size=1:12} * A unique permanent record number of an individual record contained in the * Family History Department's Ancestral File. */ class AncestralFileNumber extends AbstractElement { protected const FAMILY_SEARCH_URL = 'https://www.familysearch.org/search/family-trees/results?q.afnId='; protected const MAX_LENGTH = 12; /** * Convert a value to a canonical form. * * @param string $value * * @return string */ public function canonical(string $value): string { return strtoupper(parent::canonical($value)); } /** * Display the value of this type of element. * * @param string $value * @param Tree $tree * * @return string */ public function value(string $value, Tree $tree): string { $canonical = $this->canonical($value); $url = static::FAMILY_SEARCH_URL . rawurlencode($canonical); return '' . e($canonical) . ''; } }