xref: /webtrees/app/Contracts/LocationFactoryInterface.php (revision 1ff45046fabc22237b5d0d8e489c96f031fc598d)
10d15532eSGreg Roach<?php
20d15532eSGreg Roach
30d15532eSGreg Roach/**
40d15532eSGreg Roach * webtrees: online genealogy
5d11be702SGreg Roach * Copyright (C) 2023 webtrees development team
60d15532eSGreg Roach * This program is free software: you can redistribute it and/or modify
70d15532eSGreg Roach * it under the terms of the GNU General Public License as published by
80d15532eSGreg Roach * the Free Software Foundation, either version 3 of the License, or
90d15532eSGreg Roach * (at your option) any later version.
100d15532eSGreg Roach * This program is distributed in the hope that it will be useful,
110d15532eSGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
120d15532eSGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
130d15532eSGreg Roach * GNU General Public License for more details.
140d15532eSGreg 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/>.
160d15532eSGreg Roach */
170d15532eSGreg Roach
180d15532eSGreg Roachdeclare(strict_types=1);
190d15532eSGreg Roach
200d15532eSGreg Roachnamespace Fisharebest\Webtrees\Contracts;
210d15532eSGreg Roach
220d15532eSGreg Roachuse Closure;
230d15532eSGreg Roachuse Fisharebest\Webtrees\Location;
240d15532eSGreg Roachuse Fisharebest\Webtrees\Tree;
250d15532eSGreg Roach
260d15532eSGreg Roach/**
270d15532eSGreg Roach * Make a Location object.
280d15532eSGreg Roach */
29eb7ab465SGreg Roachinterface LocationFactoryInterface extends GedcomRecordFactoryInterface
300d15532eSGreg Roach{
310d15532eSGreg Roach    /**
320d15532eSGreg Roach     * Create a Location.
330d15532eSGreg Roach     */
34*1ff45046SGreg Roach    public function make(string $xref, Tree $tree, string|null $gedcom = null): Location|null;
350d15532eSGreg Roach
360d15532eSGreg Roach    /**
370d15532eSGreg Roach     * Create a Location from a row in the database.
380d15532eSGreg Roach     *
390d15532eSGreg Roach     * @param Tree $tree
400d15532eSGreg Roach     *
41c6921a17SGreg Roach     * @return Closure(object):Location
420d15532eSGreg Roach     */
430d15532eSGreg Roach    public function mapper(Tree $tree): Closure;
440d15532eSGreg Roach
450d15532eSGreg Roach    /**
460d15532eSGreg Roach     * Create a Location from raw GEDCOM data.
470d15532eSGreg Roach     *
480d15532eSGreg Roach     * @param string      $xref
490d15532eSGreg Roach     * @param string      $gedcom  an empty string for new/pending records
500d15532eSGreg Roach     * @param string|null $pending null for a record with no pending edits,
510d15532eSGreg Roach     *                             empty string for records with pending deletions
520d15532eSGreg Roach     * @param Tree        $tree
530d15532eSGreg Roach     *
540d15532eSGreg Roach     * @return Location
550d15532eSGreg Roach     */
56*1ff45046SGreg Roach    public function new(string $xref, string $gedcom, string|null $pending, Tree $tree): Location;
570d15532eSGreg Roach}
58