xref: /webtrees/app/Contracts/IdFactoryInterface.php (revision e5766395c1a71e715ebaadcf2d63d036d60fb649)
12e464181SGreg Roach<?php
22e464181SGreg Roach
32e464181SGreg Roach/**
42e464181SGreg Roach * webtrees: online genealogy
5d11be702SGreg Roach * Copyright (C) 2023 webtrees development team
62e464181SGreg Roach * This program is free software: you can redistribute it and/or modify
72e464181SGreg Roach * it under the terms of the GNU General Public License as published by
82e464181SGreg Roach * the Free Software Foundation, either version 3 of the License, or
92e464181SGreg Roach * (at your option) any later version.
102e464181SGreg Roach * This program is distributed in the hope that it will be useful,
112e464181SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
122e464181SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
132e464181SGreg Roach * GNU General Public License for more details.
142e464181SGreg Roach * You should have received a copy of the GNU General Public License
152e464181SGreg Roach * along with this program. If not, see <https://www.gnu.org/licenses/>.
162e464181SGreg Roach */
172e464181SGreg Roach
182e464181SGreg Roachdeclare(strict_types=1);
192e464181SGreg Roach
202e464181SGreg Roachnamespace Fisharebest\Webtrees\Contracts;
212e464181SGreg Roach
222e464181SGreg Roach/**
232e464181SGreg Roach * Create a unique identifier.
242e464181SGreg Roach */
252e464181SGreg Roachinterface IdFactoryInterface
262e464181SGreg Roach{
272e464181SGreg Roach    /**
282e464181SGreg Roach     * @return string
292e464181SGreg Roach     */
302e464181SGreg Roach    public function uuid(): string;
312e464181SGreg Roach
322e464181SGreg Roach    /**
332e464181SGreg Roach     * An identifier for use in CSS/HTML
342e464181SGreg Roach     *
3561351a03SGreg Roach     * @param string $prefix
3661351a03SGreg Roach     *
372e464181SGreg Roach     * @return string
382e464181SGreg Roach     */
392e464181SGreg Roach    public function id(string $prefix = 'id-'): string;
402e464181SGreg Roach
412e464181SGreg Roach    /**
422e464181SGreg Roach     * A value for _UID fields, as created by PAF
432e464181SGreg Roach     *
442e464181SGreg Roach     * @return string
452e464181SGreg Roach     */
462e464181SGreg Roach    public function pafUid(): string;
472e464181SGreg Roach
482e464181SGreg Roach    /**
49*e5766395SGreg Roach     * @param string $uid exactly 32 hex characters
502e464181SGreg Roach     *
512e464181SGreg Roach     * @return string
522e464181SGreg Roach     */
532e464181SGreg Roach    public function pafUidChecksum(string $uid): string;
542e464181SGreg Roach}
55