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