xref: /webtrees/app/Registry.php (revision 7e128bbfeb9f0f479efa344744b4446bc62c45c4)
16b9cb339SGreg Roach<?php
26b9cb339SGreg Roach
36b9cb339SGreg Roach/**
46b9cb339SGreg Roach * webtrees: online genealogy
55bfc6897SGreg Roach * Copyright (C) 2022 webtrees development team
66b9cb339SGreg Roach * This program is free software: you can redistribute it and/or modify
76b9cb339SGreg Roach * it under the terms of the GNU General Public License as published by
86b9cb339SGreg Roach * the Free Software Foundation, either version 3 of the License, or
96b9cb339SGreg Roach * (at your option) any later version.
106b9cb339SGreg Roach * This program is distributed in the hope that it will be useful,
116b9cb339SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
126b9cb339SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
136b9cb339SGreg Roach * GNU General Public License for more details.
146b9cb339SGreg 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/>.
166b9cb339SGreg Roach */
176b9cb339SGreg Roach
186b9cb339SGreg Roachdeclare(strict_types=1);
196b9cb339SGreg Roach
206b9cb339SGreg Roachnamespace Fisharebest\Webtrees;
216b9cb339SGreg Roach
226b9cb339SGreg Roachuse Fisharebest\Webtrees\Contracts\CacheFactoryInterface;
23f882f05dSGreg Roachuse Fisharebest\Webtrees\Contracts\CalendarDateFactoryInterface;
241c6adce8SGreg Roachuse Fisharebest\Webtrees\Contracts\EncodingFactoryInterface;
256b9cb339SGreg Roachuse Fisharebest\Webtrees\Contracts\FamilyFactoryInterface;
266b9cb339SGreg Roachuse Fisharebest\Webtrees\Contracts\FilesystemFactoryInterface;
27c2ed51d1SGreg Roachuse Fisharebest\Webtrees\Contracts\ElementFactoryInterface;
286b9cb339SGreg Roachuse Fisharebest\Webtrees\Contracts\GedcomRecordFactoryInterface;
296b9cb339SGreg Roachuse Fisharebest\Webtrees\Contracts\HeaderFactoryInterface;
306b9cb339SGreg Roachuse Fisharebest\Webtrees\Contracts\ImageFactoryInterface;
316b9cb339SGreg Roachuse Fisharebest\Webtrees\Contracts\IndividualFactoryInterface;
326b9cb339SGreg Roachuse Fisharebest\Webtrees\Contracts\LocationFactoryInterface;
334d35caa7SGreg Roachuse Fisharebest\Webtrees\Contracts\MarkdownFactoryInterface;
346b9cb339SGreg Roachuse Fisharebest\Webtrees\Contracts\MediaFactoryInterface;
356b9cb339SGreg Roachuse Fisharebest\Webtrees\Contracts\NoteFactoryInterface;
366b9cb339SGreg Roachuse Fisharebest\Webtrees\Contracts\RepositoryFactoryInterface;
37208909d8SGreg Roachuse Fisharebest\Webtrees\Contracts\ResponseFactoryInterface;
38208909d8SGreg Roachuse Fisharebest\Webtrees\Contracts\RouteFactoryInterface;
39194b0938SGreg Roachuse Fisharebest\Webtrees\Contracts\SlugFactoryInterface;
406b9cb339SGreg Roachuse Fisharebest\Webtrees\Contracts\SourceFactoryInterface;
416b9cb339SGreg Roachuse Fisharebest\Webtrees\Contracts\SubmissionFactoryInterface;
426b9cb339SGreg Roachuse Fisharebest\Webtrees\Contracts\SubmitterFactoryInterface;
43*7e128bbfSGreg Roachuse Fisharebest\Webtrees\Contracts\SurnameTraditionFactoryInterface;
44d97083feSGreg Roachuse Fisharebest\Webtrees\Contracts\TimestampFactoryInterface;
456b9cb339SGreg Roachuse Fisharebest\Webtrees\Contracts\XrefFactoryInterface;
466b9cb339SGreg Roach
476b9cb339SGreg Roach/**
486b9cb339SGreg Roach * Provide access to factory objects and those that represent external entities (filesystems, caches)
496b9cb339SGreg Roach */
506b9cb339SGreg Roachclass Registry
516b9cb339SGreg Roach{
52194b0938SGreg Roach    private static CacheFactoryInterface $cache_factory;
536b9cb339SGreg Roach
54f882f05dSGreg Roach    private static CalendarDateFactoryInterface $calendar_date_factory;
55f882f05dSGreg Roach
5600c45d23SGreg Roach    private static ElementFactoryInterface $element_factory;
5700c45d23SGreg Roach
581c6adce8SGreg Roach    private static EncodingFactoryInterface $encoding_factory;
591c6adce8SGreg Roach
6000c45d23SGreg Roach    private static FamilyFactoryInterface $family_factory;
6100c45d23SGreg Roach
6200c45d23SGreg Roach    private static FilesystemFactoryInterface $filesystem_factory;
6300c45d23SGreg Roach
6400c45d23SGreg Roach    private static GedcomRecordFactoryInterface $gedcom_record_factory;
6500c45d23SGreg Roach
6600c45d23SGreg Roach    private static HeaderFactoryInterface $header_factory;
6700c45d23SGreg Roach
6800c45d23SGreg Roach    private static ImageFactoryInterface $image_factory;
6900c45d23SGreg Roach
7000c45d23SGreg Roach    private static IndividualFactoryInterface $individual_factory;
7100c45d23SGreg Roach
7200c45d23SGreg Roach    private static LocationFactoryInterface $location_factory;
7300c45d23SGreg Roach
744d35caa7SGreg Roach    private static MarkdownFactoryInterface $markdown_factory;
754d35caa7SGreg Roach
7600c45d23SGreg Roach    private static MediaFactoryInterface $media_factory;
7700c45d23SGreg Roach
7800c45d23SGreg Roach    private static NoteFactoryInterface $note_factory;
7900c45d23SGreg Roach
8000c45d23SGreg Roach    private static RepositoryFactoryInterface $repository_factory;
8100c45d23SGreg Roach
82208909d8SGreg Roach    private static ResponseFactoryInterface $response_factory;
83208909d8SGreg Roach
84208909d8SGreg Roach    private static RouteFactoryInterface $route_factory;
85208909d8SGreg Roach
8600c45d23SGreg Roach    private static SlugFactoryInterface $slug_factory;
8700c45d23SGreg Roach
8800c45d23SGreg Roach    private static SourceFactoryInterface $source_factory;
8900c45d23SGreg Roach
9000c45d23SGreg Roach    private static SubmissionFactoryInterface $submission_factory;
9100c45d23SGreg Roach
9200c45d23SGreg Roach    private static SubmitterFactoryInterface $submitter_factory;
9300c45d23SGreg Roach
94*7e128bbfSGreg Roach    private static SurnameTraditionFactoryInterface $surname_tradition_factory;
95*7e128bbfSGreg Roach
96d97083feSGreg Roach    private static TimestampFactoryInterface $timestamp_factory;
97d97083feSGreg Roach
9800c45d23SGreg Roach    private static XrefFactoryInterface $xref_factory;
9956afe05fSGreg Roach
1006b9cb339SGreg Roach    /**
1016b9cb339SGreg Roach     * Store or retrieve a factory object.
1026b9cb339SGreg Roach     *
1036b9cb339SGreg Roach     * @param CacheFactoryInterface|null $factory
1046b9cb339SGreg Roach     *
1056b9cb339SGreg Roach     * @return CacheFactoryInterface
1066b9cb339SGreg Roach     */
1076b9cb339SGreg Roach    public static function cache(CacheFactoryInterface $factory = null): CacheFactoryInterface
1086b9cb339SGreg Roach    {
1096b9cb339SGreg Roach        if ($factory instanceof CacheFactoryInterface) {
1106b9cb339SGreg Roach            self::$cache_factory = $factory;
1116b9cb339SGreg Roach        }
1126b9cb339SGreg Roach
1136b9cb339SGreg Roach        return self::$cache_factory;
1146b9cb339SGreg Roach    }
1156b9cb339SGreg Roach
1166b9cb339SGreg Roach    /**
1176b9cb339SGreg Roach     * Store or retrieve a factory object.
1186b9cb339SGreg Roach     *
119f882f05dSGreg Roach     * @param CalendarDateFactoryInterface|null $factory
120f882f05dSGreg Roach     *
121f882f05dSGreg Roach     * @return CalendarDateFactoryInterface
122f882f05dSGreg Roach     */
123f882f05dSGreg Roach    public static function calendarDateFactory(CalendarDateFactoryInterface $factory = null): CalendarDateFactoryInterface
124f882f05dSGreg Roach    {
125f882f05dSGreg Roach        if ($factory instanceof CalendarDateFactoryInterface) {
126f882f05dSGreg Roach            self::$calendar_date_factory = $factory;
127f882f05dSGreg Roach        }
128f882f05dSGreg Roach
129f882f05dSGreg Roach        return self::$calendar_date_factory;
130f882f05dSGreg Roach    }
131f882f05dSGreg Roach
132f882f05dSGreg Roach    /**
133f882f05dSGreg Roach     * Store or retrieve a factory object.
134f882f05dSGreg Roach     *
135c2ed51d1SGreg Roach     * @param ElementFactoryInterface|null $factory
136c2ed51d1SGreg Roach     *
137c2ed51d1SGreg Roach     * @return ElementFactoryInterface
138c2ed51d1SGreg Roach     */
139c2ed51d1SGreg Roach    public static function elementFactory(ElementFactoryInterface $factory = null): ElementFactoryInterface
140c2ed51d1SGreg Roach    {
141c2ed51d1SGreg Roach        if ($factory instanceof ElementFactoryInterface) {
142c2ed51d1SGreg Roach            self::$element_factory = $factory;
143c2ed51d1SGreg Roach        }
144c2ed51d1SGreg Roach
145c2ed51d1SGreg Roach        return self::$element_factory;
146c2ed51d1SGreg Roach    }
147c2ed51d1SGreg Roach
148c2ed51d1SGreg Roach    /**
149c2ed51d1SGreg Roach     * Store or retrieve a factory object.
150c2ed51d1SGreg Roach     *
1511c6adce8SGreg Roach     * @param EncodingFactoryInterface|null $factory
1521c6adce8SGreg Roach     *
1531c6adce8SGreg Roach     * @return EncodingFactoryInterface
1541c6adce8SGreg Roach     */
1551c6adce8SGreg Roach    public static function encodingFactory(EncodingFactoryInterface $factory = null): EncodingFactoryInterface
1561c6adce8SGreg Roach    {
1571c6adce8SGreg Roach        if ($factory instanceof EncodingFactoryInterface) {
1581c6adce8SGreg Roach            self::$encoding_factory = $factory;
1591c6adce8SGreg Roach        }
1601c6adce8SGreg Roach
1611c6adce8SGreg Roach        return self::$encoding_factory;
1621c6adce8SGreg Roach    }
1631c6adce8SGreg Roach
1641c6adce8SGreg Roach    /**
1651c6adce8SGreg Roach     * Store or retrieve a factory object.
1661c6adce8SGreg Roach     *
1676b9cb339SGreg Roach     * @param FamilyFactoryInterface|null $factory
1686b9cb339SGreg Roach     *
1696b9cb339SGreg Roach     * @return FamilyFactoryInterface
1706b9cb339SGreg Roach     */
1716b9cb339SGreg Roach    public static function familyFactory(FamilyFactoryInterface $factory = null): FamilyFactoryInterface
1726b9cb339SGreg Roach    {
1736b9cb339SGreg Roach        if ($factory instanceof FamilyFactoryInterface) {
1746b9cb339SGreg Roach            self::$family_factory = $factory;
1756b9cb339SGreg Roach        }
1766b9cb339SGreg Roach
1776b9cb339SGreg Roach        return self::$family_factory;
1786b9cb339SGreg Roach    }
1796b9cb339SGreg Roach
1806b9cb339SGreg Roach    /**
1816b9cb339SGreg Roach     * Store or retrieve a factory object.
1826b9cb339SGreg Roach     *
1836b9cb339SGreg Roach     * @param FilesystemFactoryInterface|null $factory
1846b9cb339SGreg Roach     *
1856b9cb339SGreg Roach     * @return FilesystemFactoryInterface
1866b9cb339SGreg Roach     */
1876b9cb339SGreg Roach    public static function filesystem(FilesystemFactoryInterface $factory = null): FilesystemFactoryInterface
1886b9cb339SGreg Roach    {
1896b9cb339SGreg Roach        if ($factory instanceof FilesystemFactoryInterface) {
1906b9cb339SGreg Roach            self::$filesystem_factory = $factory;
1916b9cb339SGreg Roach        }
1926b9cb339SGreg Roach
1936b9cb339SGreg Roach        return self::$filesystem_factory;
1946b9cb339SGreg Roach    }
1956b9cb339SGreg Roach
1966b9cb339SGreg Roach    /**
1976b9cb339SGreg Roach     * Store or retrieve a factory object.
1986b9cb339SGreg Roach     *
1996b9cb339SGreg Roach     * @param GedcomRecordFactoryInterface|null $factory
2006b9cb339SGreg Roach     *
2016b9cb339SGreg Roach     * @return GedcomRecordFactoryInterface
2026b9cb339SGreg Roach     */
2036b9cb339SGreg Roach    public static function gedcomRecordFactory(GedcomRecordFactoryInterface $factory = null): GedcomRecordFactoryInterface
2046b9cb339SGreg Roach    {
2056b9cb339SGreg Roach        if ($factory instanceof GedcomRecordFactoryInterface) {
2066b9cb339SGreg Roach            self::$gedcom_record_factory = $factory;
2076b9cb339SGreg Roach        }
2086b9cb339SGreg Roach
2096b9cb339SGreg Roach        return self::$gedcom_record_factory;
2106b9cb339SGreg Roach    }
2116b9cb339SGreg Roach
2126b9cb339SGreg Roach    /**
2136b9cb339SGreg Roach     * Store or retrieve a factory object.
2146b9cb339SGreg Roach     *
2156b9cb339SGreg Roach     * @param HeaderFactoryInterface|null $factory
2166b9cb339SGreg Roach     *
2176b9cb339SGreg Roach     * @return HeaderFactoryInterface
2186b9cb339SGreg Roach     */
2196b9cb339SGreg Roach    public static function headerFactory(HeaderFactoryInterface $factory = null): HeaderFactoryInterface
2206b9cb339SGreg Roach    {
2216b9cb339SGreg Roach        if ($factory instanceof HeaderFactoryInterface) {
2226b9cb339SGreg Roach            self::$header_factory = $factory;
2236b9cb339SGreg Roach        }
2246b9cb339SGreg Roach
2256b9cb339SGreg Roach        return self::$header_factory;
2266b9cb339SGreg Roach    }
2276b9cb339SGreg Roach
2286b9cb339SGreg Roach    /**
2296b9cb339SGreg Roach     * Store or retrieve a factory object.
2306b9cb339SGreg Roach     *
2316b9cb339SGreg Roach     * @param ImageFactoryInterface|null $factory
2326b9cb339SGreg Roach     *
2336b9cb339SGreg Roach     * @return ImageFactoryInterface
2346b9cb339SGreg Roach     */
2356b9cb339SGreg Roach    public static function imageFactory(ImageFactoryInterface $factory = null): ImageFactoryInterface
2366b9cb339SGreg Roach    {
2376b9cb339SGreg Roach        if ($factory instanceof ImageFactoryInterface) {
2386b9cb339SGreg Roach            self::$image_factory = $factory;
2396b9cb339SGreg Roach        }
2406b9cb339SGreg Roach
2416b9cb339SGreg Roach        return self::$image_factory;
2426b9cb339SGreg Roach    }
2436b9cb339SGreg Roach
2446b9cb339SGreg Roach    /**
2456b9cb339SGreg Roach     * Store or retrieve a factory object.
2466b9cb339SGreg Roach     *
2476b9cb339SGreg Roach     * @param IndividualFactoryInterface|null $factory
2486b9cb339SGreg Roach     *
2496b9cb339SGreg Roach     * @return IndividualFactoryInterface
2506b9cb339SGreg Roach     */
2516b9cb339SGreg Roach    public static function individualFactory(IndividualFactoryInterface $factory = null): IndividualFactoryInterface
2526b9cb339SGreg Roach    {
2536b9cb339SGreg Roach        if ($factory instanceof IndividualFactoryInterface) {
2546b9cb339SGreg Roach            self::$individual_factory = $factory;
2556b9cb339SGreg Roach        }
2566b9cb339SGreg Roach
2576b9cb339SGreg Roach        return self::$individual_factory;
2586b9cb339SGreg Roach    }
2596b9cb339SGreg Roach
2606b9cb339SGreg Roach    /**
2616b9cb339SGreg Roach     * Store or retrieve a factory object.
2626b9cb339SGreg Roach     *
2636b9cb339SGreg Roach     * @param LocationFactoryInterface|null $factory
2646b9cb339SGreg Roach     *
2656b9cb339SGreg Roach     * @return LocationFactoryInterface
2666b9cb339SGreg Roach     */
2676b9cb339SGreg Roach    public static function locationFactory(LocationFactoryInterface $factory = null): LocationFactoryInterface
2686b9cb339SGreg Roach    {
2696b9cb339SGreg Roach        if ($factory instanceof LocationFactoryInterface) {
2706b9cb339SGreg Roach            self::$location_factory = $factory;
2716b9cb339SGreg Roach        }
2726b9cb339SGreg Roach
2736b9cb339SGreg Roach        return self::$location_factory;
2746b9cb339SGreg Roach    }
2756b9cb339SGreg Roach
2766b9cb339SGreg Roach    /**
2776b9cb339SGreg Roach     * Store or retrieve a factory object.
2786b9cb339SGreg Roach     *
2794d35caa7SGreg Roach     * @param MarkdownFactoryInterface|null $factory
2804d35caa7SGreg Roach     *
2814d35caa7SGreg Roach     * @return MarkdownFactoryInterface
2824d35caa7SGreg Roach     */
2834d35caa7SGreg Roach    public static function markdownFactory(MarkdownFactoryInterface $factory = null): MarkdownFactoryInterface
2844d35caa7SGreg Roach    {
2854d35caa7SGreg Roach        if ($factory instanceof MarkdownFactoryInterface) {
2864d35caa7SGreg Roach            self::$markdown_factory = $factory;
2874d35caa7SGreg Roach        }
2884d35caa7SGreg Roach
2894d35caa7SGreg Roach        return self::$markdown_factory;
2904d35caa7SGreg Roach    }
2914d35caa7SGreg Roach
2924d35caa7SGreg Roach    /**
2934d35caa7SGreg Roach     * Store or retrieve a factory object.
2944d35caa7SGreg Roach     *
2956b9cb339SGreg Roach     * @param MediaFactoryInterface|null $factory
2966b9cb339SGreg Roach     *
2976b9cb339SGreg Roach     * @return MediaFactoryInterface
2986b9cb339SGreg Roach     */
2996b9cb339SGreg Roach    public static function mediaFactory(MediaFactoryInterface $factory = null): MediaFactoryInterface
3006b9cb339SGreg Roach    {
3016b9cb339SGreg Roach        if ($factory instanceof MediaFactoryInterface) {
3026b9cb339SGreg Roach            self::$media_factory = $factory;
3036b9cb339SGreg Roach        }
3046b9cb339SGreg Roach
3056b9cb339SGreg Roach        return self::$media_factory;
3066b9cb339SGreg Roach    }
3076b9cb339SGreg Roach
3086b9cb339SGreg Roach    /**
3096b9cb339SGreg Roach     * Store or retrieve a factory object.
3106b9cb339SGreg Roach     *
3116b9cb339SGreg Roach     * @param NoteFactoryInterface|null $factory
3126b9cb339SGreg Roach     *
3136b9cb339SGreg Roach     * @return NoteFactoryInterface
3146b9cb339SGreg Roach     */
3156b9cb339SGreg Roach    public static function noteFactory(NoteFactoryInterface $factory = null): NoteFactoryInterface
3166b9cb339SGreg Roach    {
3176b9cb339SGreg Roach        if ($factory instanceof NoteFactoryInterface) {
3186b9cb339SGreg Roach            self::$note_factory = $factory;
3196b9cb339SGreg Roach        }
3206b9cb339SGreg Roach
3216b9cb339SGreg Roach        return self::$note_factory;
3226b9cb339SGreg Roach    }
3236b9cb339SGreg Roach
3246b9cb339SGreg Roach    /**
3256b9cb339SGreg Roach     * Store or retrieve a factory object.
3266b9cb339SGreg Roach     *
3276b9cb339SGreg Roach     * @param RepositoryFactoryInterface|null $factory
3286b9cb339SGreg Roach     *
3296b9cb339SGreg Roach     * @return RepositoryFactoryInterface
3306b9cb339SGreg Roach     */
3316b9cb339SGreg Roach    public static function repositoryFactory(RepositoryFactoryInterface $factory = null): RepositoryFactoryInterface
3326b9cb339SGreg Roach    {
3336b9cb339SGreg Roach        if ($factory instanceof RepositoryFactoryInterface) {
3346b9cb339SGreg Roach            self::$repository_factory = $factory;
3356b9cb339SGreg Roach        }
3366b9cb339SGreg Roach
3376b9cb339SGreg Roach        return self::$repository_factory;
3386b9cb339SGreg Roach    }
3396b9cb339SGreg Roach
3406b9cb339SGreg Roach    /**
3416b9cb339SGreg Roach     * Store or retrieve a factory object.
3426b9cb339SGreg Roach     *
343208909d8SGreg Roach     * @param ResponseFactoryInterface|null $factory
344208909d8SGreg Roach     *
345208909d8SGreg Roach     * @return ResponseFactoryInterface
346208909d8SGreg Roach     */
347208909d8SGreg Roach    public static function responseFactory(ResponseFactoryInterface $factory = null): ResponseFactoryInterface
348208909d8SGreg Roach    {
349208909d8SGreg Roach        if ($factory instanceof ResponseFactoryInterface) {
350208909d8SGreg Roach            self::$response_factory = $factory;
351208909d8SGreg Roach        }
352208909d8SGreg Roach
353208909d8SGreg Roach        return self::$response_factory;
354208909d8SGreg Roach    }
355208909d8SGreg Roach
356208909d8SGreg Roach    /**
357208909d8SGreg Roach     * Store or retrieve a factory object.
358208909d8SGreg Roach     *
359208909d8SGreg Roach     * @param RouteFactoryInterface|null $factory
360208909d8SGreg Roach     *
361208909d8SGreg Roach     * @return RouteFactoryInterface
362208909d8SGreg Roach     */
363208909d8SGreg Roach    public static function routeFactory(RouteFactoryInterface $factory = null): RouteFactoryInterface
364208909d8SGreg Roach    {
365208909d8SGreg Roach        if ($factory instanceof RouteFactoryInterface) {
366208909d8SGreg Roach            self::$route_factory = $factory;
367208909d8SGreg Roach        }
368208909d8SGreg Roach
369208909d8SGreg Roach        return self::$route_factory;
370208909d8SGreg Roach    }
371208909d8SGreg Roach
372208909d8SGreg Roach    /**
373208909d8SGreg Roach     * Store or retrieve a factory object.
374208909d8SGreg Roach     *
375194b0938SGreg Roach     * @param SlugFactoryInterface|null $factory
376194b0938SGreg Roach     *
377194b0938SGreg Roach     * @return SlugFactoryInterface
378194b0938SGreg Roach     */
379194b0938SGreg Roach    public static function slugFactory(SlugFactoryInterface $factory = null): SlugFactoryInterface
380194b0938SGreg Roach    {
381194b0938SGreg Roach        if ($factory instanceof SlugFactoryInterface) {
382194b0938SGreg Roach            self::$slug_factory = $factory;
383194b0938SGreg Roach        }
384194b0938SGreg Roach
385194b0938SGreg Roach        return self::$slug_factory;
386194b0938SGreg Roach    }
387194b0938SGreg Roach
388194b0938SGreg Roach    /**
389194b0938SGreg Roach     * Store or retrieve a factory object.
390194b0938SGreg Roach     *
3916b9cb339SGreg Roach     * @param SourceFactoryInterface|null $factory
3926b9cb339SGreg Roach     *
3936b9cb339SGreg Roach     * @return SourceFactoryInterface
3946b9cb339SGreg Roach     */
3956b9cb339SGreg Roach    public static function sourceFactory(SourceFactoryInterface $factory = null): SourceFactoryInterface
3966b9cb339SGreg Roach    {
3976b9cb339SGreg Roach        if ($factory instanceof SourceFactoryInterface) {
3986b9cb339SGreg Roach            self::$source_factory = $factory;
3996b9cb339SGreg Roach        }
4006b9cb339SGreg Roach
4016b9cb339SGreg Roach        return self::$source_factory;
4026b9cb339SGreg Roach    }
4036b9cb339SGreg Roach
4046b9cb339SGreg Roach    /**
4056b9cb339SGreg Roach     * Store or retrieve a factory object.
4066b9cb339SGreg Roach     *
4076b9cb339SGreg Roach     * @param SubmissionFactoryInterface|null $factory
4086b9cb339SGreg Roach     *
4096b9cb339SGreg Roach     * @return SubmissionFactoryInterface
4106b9cb339SGreg Roach     */
4116b9cb339SGreg Roach    public static function submissionFactory(SubmissionFactoryInterface $factory = null): SubmissionFactoryInterface
4126b9cb339SGreg Roach    {
4136b9cb339SGreg Roach        if ($factory instanceof SubmissionFactoryInterface) {
4146b9cb339SGreg Roach            self::$submission_factory = $factory;
4156b9cb339SGreg Roach        }
4166b9cb339SGreg Roach
4176b9cb339SGreg Roach        return self::$submission_factory;
4186b9cb339SGreg Roach    }
4196b9cb339SGreg Roach
4206b9cb339SGreg Roach    /**
4216b9cb339SGreg Roach     * Store or retrieve a factory object.
4226b9cb339SGreg Roach     *
4236b9cb339SGreg Roach     * @param SubmitterFactoryInterface|null $factory
4246b9cb339SGreg Roach     *
4256b9cb339SGreg Roach     * @return SubmitterFactoryInterface
4266b9cb339SGreg Roach     */
4276b9cb339SGreg Roach    public static function submitterFactory(SubmitterFactoryInterface $factory = null): SubmitterFactoryInterface
4286b9cb339SGreg Roach    {
4296b9cb339SGreg Roach        if ($factory instanceof SubmitterFactoryInterface) {
4306b9cb339SGreg Roach            self::$submitter_factory = $factory;
4316b9cb339SGreg Roach        }
4326b9cb339SGreg Roach
4336b9cb339SGreg Roach        return self::$submitter_factory;
4346b9cb339SGreg Roach    }
4356b9cb339SGreg Roach
4366b9cb339SGreg Roach    /**
4376b9cb339SGreg Roach     * Store or retrieve a factory object.
4386b9cb339SGreg Roach     *
439*7e128bbfSGreg Roach     * @param SurnameTraditionFactoryInterface|null $factory
440*7e128bbfSGreg Roach     *
441*7e128bbfSGreg Roach     * @return SurnameTraditionFactoryInterface
442*7e128bbfSGreg Roach     */
443*7e128bbfSGreg Roach    public static function surnameTraditionFactory(SurnameTraditionFactoryInterface $factory = null): SurnameTraditionFactoryInterface
444*7e128bbfSGreg Roach    {
445*7e128bbfSGreg Roach        if ($factory instanceof SurnameTraditionFactoryInterface) {
446*7e128bbfSGreg Roach            self::$surname_tradition_factory = $factory;
447*7e128bbfSGreg Roach        }
448*7e128bbfSGreg Roach
449*7e128bbfSGreg Roach        return self::$surname_tradition_factory;
450*7e128bbfSGreg Roach    }
451*7e128bbfSGreg Roach
452*7e128bbfSGreg Roach    /**
453*7e128bbfSGreg Roach     * Store or retrieve a factory object.
454*7e128bbfSGreg Roach     *
455d97083feSGreg Roach     * @param TimestampFactoryInterface|null $factory
456d97083feSGreg Roach     *
457d97083feSGreg Roach     * @return TimestampFactoryInterface
458d97083feSGreg Roach     */
459d97083feSGreg Roach    public static function timestampFactory(TimestampFactoryInterface $factory = null): TimestampFactoryInterface
460d97083feSGreg Roach    {
461d97083feSGreg Roach        if ($factory instanceof TimestampFactoryInterface) {
462d97083feSGreg Roach            self::$timestamp_factory = $factory;
463d97083feSGreg Roach        }
464d97083feSGreg Roach
465d97083feSGreg Roach        return self::$timestamp_factory;
466d97083feSGreg Roach    }
467d97083feSGreg Roach
468d97083feSGreg Roach    /**
469d97083feSGreg Roach     * Store or retrieve a factory object.
470d97083feSGreg Roach     *
4716b9cb339SGreg Roach     * @param XrefFactoryInterface|null $factory
4726b9cb339SGreg Roach     *
4736b9cb339SGreg Roach     * @return XrefFactoryInterface
4746b9cb339SGreg Roach     */
4756b9cb339SGreg Roach    public static function xrefFactory(XrefFactoryInterface $factory = null): XrefFactoryInterface
4766b9cb339SGreg Roach    {
4776b9cb339SGreg Roach        if ($factory instanceof XrefFactoryInterface) {
4786b9cb339SGreg Roach            self::$xref_factory = $factory;
4796b9cb339SGreg Roach        }
4806b9cb339SGreg Roach
4816b9cb339SGreg Roach        return self::$xref_factory;
4826b9cb339SGreg Roach    }
4836b9cb339SGreg Roach}
484