xref: /webtrees/app/Contracts/SurnameTraditionFactoryInterface.php (revision ab2c91523aeb171fd76225844c6c3c0d2440dda3)
1<?php
2
3/**
4 * webtrees: online genealogy
5 * Copyright (C) 2022 webtrees development team
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <https://www.gnu.org/licenses/>.
16 */
17
18declare(strict_types=1);
19
20namespace Fisharebest\Webtrees\Contracts;
21
22use Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition;
23use Fisharebest\Webtrees\SurnameTradition\IcelandicSurnameTradition;
24use Fisharebest\Webtrees\SurnameTradition\LithuanianSurnameTradition;
25use Fisharebest\Webtrees\SurnameTradition\MatrilinealSurnameTradition;
26use Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition;
27use Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition;
28use Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition;
29use Fisharebest\Webtrees\SurnameTradition\PortugueseSurnameTradition;
30use Fisharebest\Webtrees\SurnameTradition\SpanishSurnameTradition;
31use Fisharebest\Webtrees\SurnameTradition\SurnameTraditionInterface;
32
33/**
34 * Create a surname tradition.
35 */
36interface SurnameTraditionFactoryInterface
37{
38    public const PATERNAL    = 'paternal';
39    public const PATRILINEAL = 'patrilineal';
40    public const MATRILINEAL = 'matrilineal';
41    public const PORTUGUESE  = 'portuguese';
42    public const SPANISH     = 'spanish';
43    public const POLISH      = 'polish';
44    public const LITHUANIAN  = 'lithuanian';
45    public const ICELANDIC   = 'icelandic';
46    public const DEFAULT     = '';
47
48    /**
49     * A list of supported surname traditions and their names.
50     *
51     * @return array<string,string>
52     */
53    public function list(): array;
54
55    /**
56     * Create a named surname tradition.
57     *
58     * @param string $name
59     *
60     * @return SurnameTraditionInterface
61     */
62    public function make(string $name): SurnameTraditionInterface;
63
64    /**
65     * @param string                    $name
66     * @param SurnameTraditionInterface $surname_tradition
67     *
68     * @return void
69     */
70    public function register(string $name, SurnameTraditionInterface $surname_tradition): void;
71}
72