xref: /webtrees/app/Registry.php (revision 5bfc689774bb9a6401271c4ed15a6d50652c991b)
16b9cb339SGreg Roach<?php
26b9cb339SGreg Roach
36b9cb339SGreg Roach/**
46b9cb339SGreg Roach * webtrees: online genealogy
5*5bfc6897SGreg 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;
43d97083feSGreg Roachuse Fisharebest\Webtrees\Contracts\TimestampFactoryInterface;
446b9cb339SGreg Roachuse Fisharebest\Webtrees\Contracts\XrefFactoryInterface;
456b9cb339SGreg Roach
466b9cb339SGreg Roach/**
476b9cb339SGreg Roach * Provide access to factory objects and those that represent external entities (filesystems, caches)
486b9cb339SGreg Roach */
496b9cb339SGreg Roachclass Registry
506b9cb339SGreg Roach{
51194b0938SGreg Roach    private static CacheFactoryInterface $cache_factory;
526b9cb339SGreg Roach
53f882f05dSGreg Roach    private static CalendarDateFactoryInterface $calendar_date_factory;
54f882f05dSGreg Roach
5500c45d23SGreg Roach    private static ElementFactoryInterface $element_factory;
5600c45d23SGreg Roach
571c6adce8SGreg Roach    private static EncodingFactoryInterface $encoding_factory;
581c6adce8SGreg Roach
5900c45d23SGreg Roach    private static FamilyFactoryInterface $family_factory;
6000c45d23SGreg Roach
6100c45d23SGreg Roach    private static FilesystemFactoryInterface $filesystem_factory;
6200c45d23SGreg Roach
6300c45d23SGreg Roach    private static GedcomRecordFactoryInterface $gedcom_record_factory;
6400c45d23SGreg Roach
6500c45d23SGreg Roach    private static HeaderFactoryInterface $header_factory;
6600c45d23SGreg Roach
6700c45d23SGreg Roach    private static ImageFactoryInterface $image_factory;
6800c45d23SGreg Roach
6900c45d23SGreg Roach    private static IndividualFactoryInterface $individual_factory;
7000c45d23SGreg Roach
7100c45d23SGreg Roach    private static LocationFactoryInterface $location_factory;
7200c45d23SGreg Roach
734d35caa7SGreg Roach    private static MarkdownFactoryInterface $markdown_factory;
744d35caa7SGreg Roach
7500c45d23SGreg Roach    private static MediaFactoryInterface $media_factory;
7600c45d23SGreg Roach
7700c45d23SGreg Roach    private static NoteFactoryInterface $note_factory;
7800c45d23SGreg Roach
7900c45d23SGreg Roach    private static RepositoryFactoryInterface $repository_factory;
8000c45d23SGreg Roach
81208909d8SGreg Roach    private static ResponseFactoryInterface $response_factory;
82208909d8SGreg Roach
83208909d8SGreg Roach    private static RouteFactoryInterface $route_factory;
84208909d8SGreg Roach
8500c45d23SGreg Roach    private static SlugFactoryInterface $slug_factory;
8600c45d23SGreg Roach
8700c45d23SGreg Roach    private static SourceFactoryInterface $source_factory;
8800c45d23SGreg Roach
8900c45d23SGreg Roach    private static SubmissionFactoryInterface $submission_factory;
9000c45d23SGreg Roach
9100c45d23SGreg Roach    private static SubmitterFactoryInterface $submitter_factory;
9200c45d23SGreg Roach
93d97083feSGreg Roach    private static TimestampFactoryInterface $timestamp_factory;
94d97083feSGreg Roach
9500c45d23SGreg Roach    private static XrefFactoryInterface $xref_factory;
9656afe05fSGreg Roach
976b9cb339SGreg Roach    /**
986b9cb339SGreg Roach     * Store or retrieve a factory object.
996b9cb339SGreg Roach     *
1006b9cb339SGreg Roach     * @param CacheFactoryInterface|null $factory
1016b9cb339SGreg Roach     *
1026b9cb339SGreg Roach     * @return CacheFactoryInterface
1036b9cb339SGreg Roach     */
1046b9cb339SGreg Roach    public static function cache(CacheFactoryInterface $factory = null): CacheFactoryInterface
1056b9cb339SGreg Roach    {
1066b9cb339SGreg Roach        if ($factory instanceof CacheFactoryInterface) {
1076b9cb339SGreg Roach            self::$cache_factory = $factory;
1086b9cb339SGreg Roach        }
1096b9cb339SGreg Roach
1106b9cb339SGreg Roach        return self::$cache_factory;
1116b9cb339SGreg Roach    }
1126b9cb339SGreg Roach
1136b9cb339SGreg Roach    /**
1146b9cb339SGreg Roach     * Store or retrieve a factory object.
1156b9cb339SGreg Roach     *
116f882f05dSGreg Roach     * @param CalendarDateFactoryInterface|null $factory
117f882f05dSGreg Roach     *
118f882f05dSGreg Roach     * @return CalendarDateFactoryInterface
119f882f05dSGreg Roach     */
120f882f05dSGreg Roach    public static function calendarDateFactory(CalendarDateFactoryInterface $factory = null): CalendarDateFactoryInterface
121f882f05dSGreg Roach    {
122f882f05dSGreg Roach        if ($factory instanceof CalendarDateFactoryInterface) {
123f882f05dSGreg Roach            self::$calendar_date_factory = $factory;
124f882f05dSGreg Roach        }
125f882f05dSGreg Roach
126f882f05dSGreg Roach        return self::$calendar_date_factory;
127f882f05dSGreg Roach    }
128f882f05dSGreg Roach
129f882f05dSGreg Roach    /**
130f882f05dSGreg Roach     * Store or retrieve a factory object.
131f882f05dSGreg Roach     *
132c2ed51d1SGreg Roach     * @param ElementFactoryInterface|null $factory
133c2ed51d1SGreg Roach     *
134c2ed51d1SGreg Roach     * @return ElementFactoryInterface
135c2ed51d1SGreg Roach     */
136c2ed51d1SGreg Roach    public static function elementFactory(ElementFactoryInterface $factory = null): ElementFactoryInterface
137c2ed51d1SGreg Roach    {
138c2ed51d1SGreg Roach        if ($factory instanceof ElementFactoryInterface) {
139c2ed51d1SGreg Roach            self::$element_factory = $factory;
140c2ed51d1SGreg Roach        }
141c2ed51d1SGreg Roach
142c2ed51d1SGreg Roach        return self::$element_factory;
143c2ed51d1SGreg Roach    }
144c2ed51d1SGreg Roach
145c2ed51d1SGreg Roach    /**
146c2ed51d1SGreg Roach     * Store or retrieve a factory object.
147c2ed51d1SGreg Roach     *
1481c6adce8SGreg Roach     * @param EncodingFactoryInterface|null $factory
1491c6adce8SGreg Roach     *
1501c6adce8SGreg Roach     * @return EncodingFactoryInterface
1511c6adce8SGreg Roach     */
1521c6adce8SGreg Roach    public static function encodingFactory(EncodingFactoryInterface $factory = null): EncodingFactoryInterface
1531c6adce8SGreg Roach    {
1541c6adce8SGreg Roach        if ($factory instanceof EncodingFactoryInterface) {
1551c6adce8SGreg Roach            self::$encoding_factory = $factory;
1561c6adce8SGreg Roach        }
1571c6adce8SGreg Roach
1581c6adce8SGreg Roach        return self::$encoding_factory;
1591c6adce8SGreg Roach    }
1601c6adce8SGreg Roach
1611c6adce8SGreg Roach    /**
1621c6adce8SGreg Roach     * Store or retrieve a factory object.
1631c6adce8SGreg Roach     *
1646b9cb339SGreg Roach     * @param FamilyFactoryInterface|null $factory
1656b9cb339SGreg Roach     *
1666b9cb339SGreg Roach     * @return FamilyFactoryInterface
1676b9cb339SGreg Roach     */
1686b9cb339SGreg Roach    public static function familyFactory(FamilyFactoryInterface $factory = null): FamilyFactoryInterface
1696b9cb339SGreg Roach    {
1706b9cb339SGreg Roach        if ($factory instanceof FamilyFactoryInterface) {
1716b9cb339SGreg Roach            self::$family_factory = $factory;
1726b9cb339SGreg Roach        }
1736b9cb339SGreg Roach
1746b9cb339SGreg Roach        return self::$family_factory;
1756b9cb339SGreg Roach    }
1766b9cb339SGreg Roach
1776b9cb339SGreg Roach    /**
1786b9cb339SGreg Roach     * Store or retrieve a factory object.
1796b9cb339SGreg Roach     *
1806b9cb339SGreg Roach     * @param FilesystemFactoryInterface|null $factory
1816b9cb339SGreg Roach     *
1826b9cb339SGreg Roach     * @return FilesystemFactoryInterface
1836b9cb339SGreg Roach     */
1846b9cb339SGreg Roach    public static function filesystem(FilesystemFactoryInterface $factory = null): FilesystemFactoryInterface
1856b9cb339SGreg Roach    {
1866b9cb339SGreg Roach        if ($factory instanceof FilesystemFactoryInterface) {
1876b9cb339SGreg Roach            self::$filesystem_factory = $factory;
1886b9cb339SGreg Roach        }
1896b9cb339SGreg Roach
1906b9cb339SGreg Roach        return self::$filesystem_factory;
1916b9cb339SGreg Roach    }
1926b9cb339SGreg Roach
1936b9cb339SGreg Roach    /**
1946b9cb339SGreg Roach     * Store or retrieve a factory object.
1956b9cb339SGreg Roach     *
1966b9cb339SGreg Roach     * @param GedcomRecordFactoryInterface|null $factory
1976b9cb339SGreg Roach     *
1986b9cb339SGreg Roach     * @return GedcomRecordFactoryInterface
1996b9cb339SGreg Roach     */
2006b9cb339SGreg Roach    public static function gedcomRecordFactory(GedcomRecordFactoryInterface $factory = null): GedcomRecordFactoryInterface
2016b9cb339SGreg Roach    {
2026b9cb339SGreg Roach        if ($factory instanceof GedcomRecordFactoryInterface) {
2036b9cb339SGreg Roach            self::$gedcom_record_factory = $factory;
2046b9cb339SGreg Roach        }
2056b9cb339SGreg Roach
2066b9cb339SGreg Roach        return self::$gedcom_record_factory;
2076b9cb339SGreg Roach    }
2086b9cb339SGreg Roach
2096b9cb339SGreg Roach    /**
2106b9cb339SGreg Roach     * Store or retrieve a factory object.
2116b9cb339SGreg Roach     *
2126b9cb339SGreg Roach     * @param HeaderFactoryInterface|null $factory
2136b9cb339SGreg Roach     *
2146b9cb339SGreg Roach     * @return HeaderFactoryInterface
2156b9cb339SGreg Roach     */
2166b9cb339SGreg Roach    public static function headerFactory(HeaderFactoryInterface $factory = null): HeaderFactoryInterface
2176b9cb339SGreg Roach    {
2186b9cb339SGreg Roach        if ($factory instanceof HeaderFactoryInterface) {
2196b9cb339SGreg Roach            self::$header_factory = $factory;
2206b9cb339SGreg Roach        }
2216b9cb339SGreg Roach
2226b9cb339SGreg Roach        return self::$header_factory;
2236b9cb339SGreg Roach    }
2246b9cb339SGreg Roach
2256b9cb339SGreg Roach    /**
2266b9cb339SGreg Roach     * Store or retrieve a factory object.
2276b9cb339SGreg Roach     *
2286b9cb339SGreg Roach     * @param ImageFactoryInterface|null $factory
2296b9cb339SGreg Roach     *
2306b9cb339SGreg Roach     * @return ImageFactoryInterface
2316b9cb339SGreg Roach     */
2326b9cb339SGreg Roach    public static function imageFactory(ImageFactoryInterface $factory = null): ImageFactoryInterface
2336b9cb339SGreg Roach    {
2346b9cb339SGreg Roach        if ($factory instanceof ImageFactoryInterface) {
2356b9cb339SGreg Roach            self::$image_factory = $factory;
2366b9cb339SGreg Roach        }
2376b9cb339SGreg Roach
2386b9cb339SGreg Roach        return self::$image_factory;
2396b9cb339SGreg Roach    }
2406b9cb339SGreg Roach
2416b9cb339SGreg Roach    /**
2426b9cb339SGreg Roach     * Store or retrieve a factory object.
2436b9cb339SGreg Roach     *
2446b9cb339SGreg Roach     * @param IndividualFactoryInterface|null $factory
2456b9cb339SGreg Roach     *
2466b9cb339SGreg Roach     * @return IndividualFactoryInterface
2476b9cb339SGreg Roach     */
2486b9cb339SGreg Roach    public static function individualFactory(IndividualFactoryInterface $factory = null): IndividualFactoryInterface
2496b9cb339SGreg Roach    {
2506b9cb339SGreg Roach        if ($factory instanceof IndividualFactoryInterface) {
2516b9cb339SGreg Roach            self::$individual_factory = $factory;
2526b9cb339SGreg Roach        }
2536b9cb339SGreg Roach
2546b9cb339SGreg Roach        return self::$individual_factory;
2556b9cb339SGreg Roach    }
2566b9cb339SGreg Roach
2576b9cb339SGreg Roach    /**
2586b9cb339SGreg Roach     * Store or retrieve a factory object.
2596b9cb339SGreg Roach     *
2606b9cb339SGreg Roach     * @param LocationFactoryInterface|null $factory
2616b9cb339SGreg Roach     *
2626b9cb339SGreg Roach     * @return LocationFactoryInterface
2636b9cb339SGreg Roach     */
2646b9cb339SGreg Roach    public static function locationFactory(LocationFactoryInterface $factory = null): LocationFactoryInterface
2656b9cb339SGreg Roach    {
2666b9cb339SGreg Roach        if ($factory instanceof LocationFactoryInterface) {
2676b9cb339SGreg Roach            self::$location_factory = $factory;
2686b9cb339SGreg Roach        }
2696b9cb339SGreg Roach
2706b9cb339SGreg Roach        return self::$location_factory;
2716b9cb339SGreg Roach    }
2726b9cb339SGreg Roach
2736b9cb339SGreg Roach    /**
2746b9cb339SGreg Roach     * Store or retrieve a factory object.
2756b9cb339SGreg Roach     *
2764d35caa7SGreg Roach     * @param MarkdownFactoryInterface|null $factory
2774d35caa7SGreg Roach     *
2784d35caa7SGreg Roach     * @return MarkdownFactoryInterface
2794d35caa7SGreg Roach     */
2804d35caa7SGreg Roach    public static function markdownFactory(MarkdownFactoryInterface $factory = null): MarkdownFactoryInterface
2814d35caa7SGreg Roach    {
2824d35caa7SGreg Roach        if ($factory instanceof MarkdownFactoryInterface) {
2834d35caa7SGreg Roach            self::$markdown_factory = $factory;
2844d35caa7SGreg Roach        }
2854d35caa7SGreg Roach
2864d35caa7SGreg Roach        return self::$markdown_factory;
2874d35caa7SGreg Roach    }
2884d35caa7SGreg Roach
2894d35caa7SGreg Roach    /**
2904d35caa7SGreg Roach     * Store or retrieve a factory object.
2914d35caa7SGreg Roach     *
2926b9cb339SGreg Roach     * @param MediaFactoryInterface|null $factory
2936b9cb339SGreg Roach     *
2946b9cb339SGreg Roach     * @return MediaFactoryInterface
2956b9cb339SGreg Roach     */
2966b9cb339SGreg Roach    public static function mediaFactory(MediaFactoryInterface $factory = null): MediaFactoryInterface
2976b9cb339SGreg Roach    {
2986b9cb339SGreg Roach        if ($factory instanceof MediaFactoryInterface) {
2996b9cb339SGreg Roach            self::$media_factory = $factory;
3006b9cb339SGreg Roach        }
3016b9cb339SGreg Roach
3026b9cb339SGreg Roach        return self::$media_factory;
3036b9cb339SGreg Roach    }
3046b9cb339SGreg Roach
3056b9cb339SGreg Roach    /**
3066b9cb339SGreg Roach     * Store or retrieve a factory object.
3076b9cb339SGreg Roach     *
3086b9cb339SGreg Roach     * @param NoteFactoryInterface|null $factory
3096b9cb339SGreg Roach     *
3106b9cb339SGreg Roach     * @return NoteFactoryInterface
3116b9cb339SGreg Roach     */
3126b9cb339SGreg Roach    public static function noteFactory(NoteFactoryInterface $factory = null): NoteFactoryInterface
3136b9cb339SGreg Roach    {
3146b9cb339SGreg Roach        if ($factory instanceof NoteFactoryInterface) {
3156b9cb339SGreg Roach            self::$note_factory = $factory;
3166b9cb339SGreg Roach        }
3176b9cb339SGreg Roach
3186b9cb339SGreg Roach        return self::$note_factory;
3196b9cb339SGreg Roach    }
3206b9cb339SGreg Roach
3216b9cb339SGreg Roach    /**
3226b9cb339SGreg Roach     * Store or retrieve a factory object.
3236b9cb339SGreg Roach     *
3246b9cb339SGreg Roach     * @param RepositoryFactoryInterface|null $factory
3256b9cb339SGreg Roach     *
3266b9cb339SGreg Roach     * @return RepositoryFactoryInterface
3276b9cb339SGreg Roach     */
3286b9cb339SGreg Roach    public static function repositoryFactory(RepositoryFactoryInterface $factory = null): RepositoryFactoryInterface
3296b9cb339SGreg Roach    {
3306b9cb339SGreg Roach        if ($factory instanceof RepositoryFactoryInterface) {
3316b9cb339SGreg Roach            self::$repository_factory = $factory;
3326b9cb339SGreg Roach        }
3336b9cb339SGreg Roach
3346b9cb339SGreg Roach        return self::$repository_factory;
3356b9cb339SGreg Roach    }
3366b9cb339SGreg Roach
3376b9cb339SGreg Roach    /**
3386b9cb339SGreg Roach     * Store or retrieve a factory object.
3396b9cb339SGreg Roach     *
340208909d8SGreg Roach     * @param ResponseFactoryInterface|null $factory
341208909d8SGreg Roach     *
342208909d8SGreg Roach     * @return ResponseFactoryInterface
343208909d8SGreg Roach     */
344208909d8SGreg Roach    public static function responseFactory(ResponseFactoryInterface $factory = null): ResponseFactoryInterface
345208909d8SGreg Roach    {
346208909d8SGreg Roach        if ($factory instanceof ResponseFactoryInterface) {
347208909d8SGreg Roach            self::$response_factory = $factory;
348208909d8SGreg Roach        }
349208909d8SGreg Roach
350208909d8SGreg Roach        return self::$response_factory;
351208909d8SGreg Roach    }
352208909d8SGreg Roach
353208909d8SGreg Roach    /**
354208909d8SGreg Roach     * Store or retrieve a factory object.
355208909d8SGreg Roach     *
356208909d8SGreg Roach     * @param RouteFactoryInterface|null $factory
357208909d8SGreg Roach     *
358208909d8SGreg Roach     * @return RouteFactoryInterface
359208909d8SGreg Roach     */
360208909d8SGreg Roach    public static function routeFactory(RouteFactoryInterface $factory = null): RouteFactoryInterface
361208909d8SGreg Roach    {
362208909d8SGreg Roach        if ($factory instanceof RouteFactoryInterface) {
363208909d8SGreg Roach            self::$route_factory = $factory;
364208909d8SGreg Roach        }
365208909d8SGreg Roach
366208909d8SGreg Roach        return self::$route_factory;
367208909d8SGreg Roach    }
368208909d8SGreg Roach
369208909d8SGreg Roach    /**
370208909d8SGreg Roach     * Store or retrieve a factory object.
371208909d8SGreg Roach     *
372194b0938SGreg Roach     * @param SlugFactoryInterface|null $factory
373194b0938SGreg Roach     *
374194b0938SGreg Roach     * @return SlugFactoryInterface
375194b0938SGreg Roach     */
376194b0938SGreg Roach    public static function slugFactory(SlugFactoryInterface $factory = null): SlugFactoryInterface
377194b0938SGreg Roach    {
378194b0938SGreg Roach        if ($factory instanceof SlugFactoryInterface) {
379194b0938SGreg Roach            self::$slug_factory = $factory;
380194b0938SGreg Roach        }
381194b0938SGreg Roach
382194b0938SGreg Roach        return self::$slug_factory;
383194b0938SGreg Roach    }
384194b0938SGreg Roach
385194b0938SGreg Roach    /**
386194b0938SGreg Roach     * Store or retrieve a factory object.
387194b0938SGreg Roach     *
3886b9cb339SGreg Roach     * @param SourceFactoryInterface|null $factory
3896b9cb339SGreg Roach     *
3906b9cb339SGreg Roach     * @return SourceFactoryInterface
3916b9cb339SGreg Roach     */
3926b9cb339SGreg Roach    public static function sourceFactory(SourceFactoryInterface $factory = null): SourceFactoryInterface
3936b9cb339SGreg Roach    {
3946b9cb339SGreg Roach        if ($factory instanceof SourceFactoryInterface) {
3956b9cb339SGreg Roach            self::$source_factory = $factory;
3966b9cb339SGreg Roach        }
3976b9cb339SGreg Roach
3986b9cb339SGreg Roach        return self::$source_factory;
3996b9cb339SGreg Roach    }
4006b9cb339SGreg Roach
4016b9cb339SGreg Roach    /**
4026b9cb339SGreg Roach     * Store or retrieve a factory object.
4036b9cb339SGreg Roach     *
4046b9cb339SGreg Roach     * @param SubmissionFactoryInterface|null $factory
4056b9cb339SGreg Roach     *
4066b9cb339SGreg Roach     * @return SubmissionFactoryInterface
4076b9cb339SGreg Roach     */
4086b9cb339SGreg Roach    public static function submissionFactory(SubmissionFactoryInterface $factory = null): SubmissionFactoryInterface
4096b9cb339SGreg Roach    {
4106b9cb339SGreg Roach        if ($factory instanceof SubmissionFactoryInterface) {
4116b9cb339SGreg Roach            self::$submission_factory = $factory;
4126b9cb339SGreg Roach        }
4136b9cb339SGreg Roach
4146b9cb339SGreg Roach        return self::$submission_factory;
4156b9cb339SGreg Roach    }
4166b9cb339SGreg Roach
4176b9cb339SGreg Roach    /**
4186b9cb339SGreg Roach     * Store or retrieve a factory object.
4196b9cb339SGreg Roach     *
4206b9cb339SGreg Roach     * @param SubmitterFactoryInterface|null $factory
4216b9cb339SGreg Roach     *
4226b9cb339SGreg Roach     * @return SubmitterFactoryInterface
4236b9cb339SGreg Roach     */
4246b9cb339SGreg Roach    public static function submitterFactory(SubmitterFactoryInterface $factory = null): SubmitterFactoryInterface
4256b9cb339SGreg Roach    {
4266b9cb339SGreg Roach        if ($factory instanceof SubmitterFactoryInterface) {
4276b9cb339SGreg Roach            self::$submitter_factory = $factory;
4286b9cb339SGreg Roach        }
4296b9cb339SGreg Roach
4306b9cb339SGreg Roach        return self::$submitter_factory;
4316b9cb339SGreg Roach    }
4326b9cb339SGreg Roach
4336b9cb339SGreg Roach    /**
4346b9cb339SGreg Roach     * Store or retrieve a factory object.
4356b9cb339SGreg Roach     *
436d97083feSGreg Roach     * @param TimestampFactoryInterface|null $factory
437d97083feSGreg Roach     *
438d97083feSGreg Roach     * @return TimestampFactoryInterface
439d97083feSGreg Roach     */
440d97083feSGreg Roach    public static function timestampFactory(TimestampFactoryInterface $factory = null): TimestampFactoryInterface
441d97083feSGreg Roach    {
442d97083feSGreg Roach        if ($factory instanceof TimestampFactoryInterface) {
443d97083feSGreg Roach            self::$timestamp_factory = $factory;
444d97083feSGreg Roach        }
445d97083feSGreg Roach
446d97083feSGreg Roach        return self::$timestamp_factory;
447d97083feSGreg Roach    }
448d97083feSGreg Roach
449d97083feSGreg Roach    /**
450d97083feSGreg Roach     * Store or retrieve a factory object.
451d97083feSGreg Roach     *
4526b9cb339SGreg Roach     * @param XrefFactoryInterface|null $factory
4536b9cb339SGreg Roach     *
4546b9cb339SGreg Roach     * @return XrefFactoryInterface
4556b9cb339SGreg Roach     */
4566b9cb339SGreg Roach    public static function xrefFactory(XrefFactoryInterface $factory = null): XrefFactoryInterface
4576b9cb339SGreg Roach    {
4586b9cb339SGreg Roach        if ($factory instanceof XrefFactoryInterface) {
4596b9cb339SGreg Roach            self::$xref_factory = $factory;
4606b9cb339SGreg Roach        }
4616b9cb339SGreg Roach
4626b9cb339SGreg Roach        return self::$xref_factory;
4636b9cb339SGreg Roach    }
4646b9cb339SGreg Roach}
465