xref: /webtrees/app/Contracts/IdFactoryInterface.php (revision 2e464181f49de4b07e9c43f180e054c9d1ee7e4a)
1*2e464181SGreg Roach<?php
2*2e464181SGreg Roach
3*2e464181SGreg Roach/**
4*2e464181SGreg Roach * webtrees: online genealogy
5*2e464181SGreg Roach * Copyright (C) 2022 webtrees development team
6*2e464181SGreg Roach * This program is free software: you can redistribute it and/or modify
7*2e464181SGreg Roach * it under the terms of the GNU General Public License as published by
8*2e464181SGreg Roach * the Free Software Foundation, either version 3 of the License, or
9*2e464181SGreg Roach * (at your option) any later version.
10*2e464181SGreg Roach * This program is distributed in the hope that it will be useful,
11*2e464181SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
12*2e464181SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13*2e464181SGreg Roach * GNU General Public License for more details.
14*2e464181SGreg Roach * You should have received a copy of the GNU General Public License
15*2e464181SGreg Roach * along with this program. If not, see <https://www.gnu.org/licenses/>.
16*2e464181SGreg Roach */
17*2e464181SGreg Roach
18*2e464181SGreg Roachdeclare(strict_types=1);
19*2e464181SGreg Roach
20*2e464181SGreg Roachnamespace Fisharebest\Webtrees\Contracts;
21*2e464181SGreg Roach
22*2e464181SGreg Roach/**
23*2e464181SGreg Roach * Create a unique identifier.
24*2e464181SGreg Roach */
25*2e464181SGreg Roachinterface IdFactoryInterface
26*2e464181SGreg Roach{
27*2e464181SGreg Roach    /**
28*2e464181SGreg Roach     * @return string
29*2e464181SGreg Roach     */
30*2e464181SGreg Roach    public function uuid(): string;
31*2e464181SGreg Roach
32*2e464181SGreg Roach    /**
33*2e464181SGreg Roach     * An identifier for use in CSS/HTML
34*2e464181SGreg Roach     *
35*2e464181SGreg Roach     * @return string
36*2e464181SGreg Roach     */
37*2e464181SGreg Roach    public function id(string $prefix = 'id-'): string;
38*2e464181SGreg Roach
39*2e464181SGreg Roach    /**
40*2e464181SGreg Roach     * A value for _UID fields, as created by PAF
41*2e464181SGreg Roach     *
42*2e464181SGreg Roach     * @return string
43*2e464181SGreg Roach     */
44*2e464181SGreg Roach    public function pafUid(): string;
45*2e464181SGreg Roach
46*2e464181SGreg Roach    /**
47*2e464181SGreg Roach     * @param string $uid - exactly 32 hex characters
48*2e464181SGreg Roach     *
49*2e464181SGreg Roach     * @return string
50*2e464181SGreg Roach     */
51*2e464181SGreg Roach    public function pafUidChecksum(string $uid): string;
52*2e464181SGreg Roach}
53