xref: /webtrees/app/Contracts/FamilyFactoryInterface.php (revision eb7ab465b1a2fd77e9ccad5d6202bcf5d1ed487b)
1bb03c9f0SGreg Roach<?php
2bb03c9f0SGreg Roach
3bb03c9f0SGreg Roach/**
4bb03c9f0SGreg Roach * webtrees: online genealogy
5d11be702SGreg Roach * Copyright (C) 2023 webtrees development team
6bb03c9f0SGreg Roach * This program is free software: you can redistribute it and/or modify
7bb03c9f0SGreg Roach * it under the terms of the GNU General Public License as published by
8bb03c9f0SGreg Roach * the Free Software Foundation, either version 3 of the License, or
9bb03c9f0SGreg Roach * (at your option) any later version.
10bb03c9f0SGreg Roach * This program is distributed in the hope that it will be useful,
11bb03c9f0SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
12bb03c9f0SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13bb03c9f0SGreg Roach * GNU General Public License for more details.
14bb03c9f0SGreg Roach * You should have received a copy of the GNU General Public License
1589f7189bSGreg Roach * along with this program. If not, see <https://www.gnu.org/licenses/>.
16bb03c9f0SGreg Roach */
17bb03c9f0SGreg Roach
18bb03c9f0SGreg Roachdeclare(strict_types=1);
19bb03c9f0SGreg Roach
20bb03c9f0SGreg Roachnamespace Fisharebest\Webtrees\Contracts;
21bb03c9f0SGreg Roach
22bb03c9f0SGreg Roachuse Closure;
23bb03c9f0SGreg Roachuse Fisharebest\Webtrees\Family;
24bb03c9f0SGreg Roachuse Fisharebest\Webtrees\Tree;
25bb03c9f0SGreg Roach
26bb03c9f0SGreg Roach/**
27bb03c9f0SGreg Roach * Make a Family object.
28bb03c9f0SGreg Roach */
29*eb7ab465SGreg Roachinterface FamilyFactoryInterface extends GedcomRecordFactoryInterface
30bb03c9f0SGreg Roach{
3192a78a2fSGreg Roach    /**
3292a78a2fSGreg Roach     * Create a family.
3392a78a2fSGreg Roach     *
3492a78a2fSGreg Roach     * @param string      $xref
3592a78a2fSGreg Roach     * @param Tree        $tree
3692a78a2fSGreg Roach     * @param string|null $gedcom
3792a78a2fSGreg Roach     *
3892a78a2fSGreg Roach     * @return Family|null
3992a78a2fSGreg Roach     */
40bb03c9f0SGreg Roach    public function make(string $xref, Tree $tree, string $gedcom = null): ?Family;
41bb03c9f0SGreg Roach
42bb03c9f0SGreg Roach    /**
43bb03c9f0SGreg Roach     * Create a Family object from a row in the database.
44bb03c9f0SGreg Roach     *
45bb03c9f0SGreg Roach     * @param Tree $tree
46bb03c9f0SGreg Roach     *
47c6921a17SGreg Roach     * @return Closure(object):Family
48bb03c9f0SGreg Roach     */
49bb03c9f0SGreg Roach    public function mapper(Tree $tree): Closure;
50bb03c9f0SGreg Roach
51bb03c9f0SGreg Roach    /**
52bb03c9f0SGreg Roach     * Create a Family object from raw GEDCOM data.
53bb03c9f0SGreg Roach     *
54bb03c9f0SGreg Roach     * @param string      $xref
55bb03c9f0SGreg Roach     * @param string      $gedcom  an empty string for new/pending records
56bb03c9f0SGreg Roach     * @param string|null $pending null for a record with no pending edits,
57bb03c9f0SGreg Roach     *                             empty string for records with pending deletions
58bb03c9f0SGreg Roach     * @param Tree        $tree
59bb03c9f0SGreg Roach     *
60bb03c9f0SGreg Roach     * @return Family
61bb03c9f0SGreg Roach     */
62bb03c9f0SGreg Roach    public function new(string $xref, string $gedcom, ?string $pending, Tree $tree): Family;
63bb03c9f0SGreg Roach}
64