16b9cb339SGreg Roach<?php 26b9cb339SGreg Roach 36b9cb339SGreg Roach/** 46b9cb339SGreg Roach * webtrees: online genealogy 5d11be702SGreg Roach * Copyright (C) 2023 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; 24d35568b4SGreg Roachuse Fisharebest\Webtrees\Contracts\ContainerInterface; 25f0c88a96SGreg Roachuse Fisharebest\Webtrees\Contracts\ElementFactoryInterface; 261c6adce8SGreg Roachuse Fisharebest\Webtrees\Contracts\EncodingFactoryInterface; 276b9cb339SGreg Roachuse Fisharebest\Webtrees\Contracts\FamilyFactoryInterface; 286b9cb339SGreg Roachuse Fisharebest\Webtrees\Contracts\FilesystemFactoryInterface; 296b9cb339SGreg Roachuse Fisharebest\Webtrees\Contracts\GedcomRecordFactoryInterface; 306b9cb339SGreg Roachuse Fisharebest\Webtrees\Contracts\HeaderFactoryInterface; 31f0c88a96SGreg Roachuse Fisharebest\Webtrees\Contracts\IdFactoryInterface; 326b9cb339SGreg Roachuse Fisharebest\Webtrees\Contracts\ImageFactoryInterface; 336b9cb339SGreg Roachuse Fisharebest\Webtrees\Contracts\IndividualFactoryInterface; 346b9cb339SGreg Roachuse Fisharebest\Webtrees\Contracts\LocationFactoryInterface; 354d35caa7SGreg Roachuse Fisharebest\Webtrees\Contracts\MarkdownFactoryInterface; 366b9cb339SGreg Roachuse Fisharebest\Webtrees\Contracts\MediaFactoryInterface; 376b9cb339SGreg Roachuse Fisharebest\Webtrees\Contracts\NoteFactoryInterface; 386b9cb339SGreg Roachuse Fisharebest\Webtrees\Contracts\RepositoryFactoryInterface; 39208909d8SGreg Roachuse Fisharebest\Webtrees\Contracts\ResponseFactoryInterface; 40208909d8SGreg Roachuse Fisharebest\Webtrees\Contracts\RouteFactoryInterface; 41701f5d18SGreg Roachuse Fisharebest\Webtrees\Contracts\SharedNoteFactoryInterface; 42194b0938SGreg Roachuse Fisharebest\Webtrees\Contracts\SlugFactoryInterface; 436b9cb339SGreg Roachuse Fisharebest\Webtrees\Contracts\SourceFactoryInterface; 446b9cb339SGreg Roachuse Fisharebest\Webtrees\Contracts\SubmissionFactoryInterface; 456b9cb339SGreg Roachuse Fisharebest\Webtrees\Contracts\SubmitterFactoryInterface; 467e128bbfSGreg Roachuse Fisharebest\Webtrees\Contracts\SurnameTraditionFactoryInterface; 47eeec557aSGreg Roachuse Fisharebest\Webtrees\Contracts\TimeFactoryInterface; 48d97083feSGreg Roachuse Fisharebest\Webtrees\Contracts\TimestampFactoryInterface; 496b9cb339SGreg Roachuse Fisharebest\Webtrees\Contracts\XrefFactoryInterface; 506b9cb339SGreg Roach 516b9cb339SGreg Roach/** 526b9cb339SGreg Roach * Provide access to factory objects and those that represent external entities (filesystems, caches) 536b9cb339SGreg Roach */ 546b9cb339SGreg Roachclass Registry 556b9cb339SGreg Roach{ 56194b0938SGreg Roach private static CacheFactoryInterface $cache_factory; 576b9cb339SGreg Roach 58f882f05dSGreg Roach private static CalendarDateFactoryInterface $calendar_date_factory; 59f882f05dSGreg Roach 60d35568b4SGreg Roach private static ContainerInterface $container; 61d35568b4SGreg Roach 6200c45d23SGreg Roach private static ElementFactoryInterface $element_factory; 6300c45d23SGreg Roach 641c6adce8SGreg Roach private static EncodingFactoryInterface $encoding_factory; 651c6adce8SGreg Roach 6600c45d23SGreg Roach private static FamilyFactoryInterface $family_factory; 6700c45d23SGreg Roach 6800c45d23SGreg Roach private static FilesystemFactoryInterface $filesystem_factory; 6900c45d23SGreg Roach 7000c45d23SGreg Roach private static GedcomRecordFactoryInterface $gedcom_record_factory; 7100c45d23SGreg Roach 7200c45d23SGreg Roach private static HeaderFactoryInterface $header_factory; 7300c45d23SGreg Roach 742e464181SGreg Roach private static IdFactoryInterface $id_factory; 752e464181SGreg Roach 7600c45d23SGreg Roach private static ImageFactoryInterface $image_factory; 7700c45d23SGreg Roach 7800c45d23SGreg Roach private static IndividualFactoryInterface $individual_factory; 7900c45d23SGreg Roach 8000c45d23SGreg Roach private static LocationFactoryInterface $location_factory; 8100c45d23SGreg Roach 824d35caa7SGreg Roach private static MarkdownFactoryInterface $markdown_factory; 834d35caa7SGreg Roach 8400c45d23SGreg Roach private static MediaFactoryInterface $media_factory; 8500c45d23SGreg Roach 8600c45d23SGreg Roach private static NoteFactoryInterface $note_factory; 8700c45d23SGreg Roach 8800c45d23SGreg Roach private static RepositoryFactoryInterface $repository_factory; 8900c45d23SGreg Roach 90208909d8SGreg Roach private static ResponseFactoryInterface $response_factory; 91208909d8SGreg Roach 92208909d8SGreg Roach private static RouteFactoryInterface $route_factory; 93208909d8SGreg Roach 94701f5d18SGreg Roach private static SharedNoteFactoryInterface $shared_note_factory; 95701f5d18SGreg Roach 9600c45d23SGreg Roach private static SlugFactoryInterface $slug_factory; 9700c45d23SGreg Roach 9800c45d23SGreg Roach private static SourceFactoryInterface $source_factory; 9900c45d23SGreg Roach 10000c45d23SGreg Roach private static SubmissionFactoryInterface $submission_factory; 10100c45d23SGreg Roach 10200c45d23SGreg Roach private static SubmitterFactoryInterface $submitter_factory; 10300c45d23SGreg Roach 1047e128bbfSGreg Roach private static SurnameTraditionFactoryInterface $surname_tradition_factory; 1057e128bbfSGreg Roach 106eeec557aSGreg Roach private static TimeFactoryInterface $time_factory; 107eeec557aSGreg Roach 108d97083feSGreg Roach private static TimestampFactoryInterface $timestamp_factory; 109d97083feSGreg Roach 11000c45d23SGreg Roach private static XrefFactoryInterface $xref_factory; 11156afe05fSGreg Roach 1126b9cb339SGreg Roach /** 1136b9cb339SGreg Roach * Store or retrieve a factory object. 1146b9cb339SGreg Roach * 1156b9cb339SGreg Roach * @param CacheFactoryInterface|null $factory 1166b9cb339SGreg Roach * 1176b9cb339SGreg Roach * @return CacheFactoryInterface 1186b9cb339SGreg Roach */ 119*2c6f1bd5SGreg Roach public static function cache(CacheFactoryInterface|null $factory = null): CacheFactoryInterface 1206b9cb339SGreg Roach { 1216b9cb339SGreg Roach if ($factory instanceof CacheFactoryInterface) { 1226b9cb339SGreg Roach self::$cache_factory = $factory; 1236b9cb339SGreg Roach } 1246b9cb339SGreg Roach 1256b9cb339SGreg Roach return self::$cache_factory; 1266b9cb339SGreg Roach } 1276b9cb339SGreg Roach 1286b9cb339SGreg Roach /** 1296b9cb339SGreg Roach * Store or retrieve a factory object. 1306b9cb339SGreg Roach * 131f882f05dSGreg Roach * @param CalendarDateFactoryInterface|null $factory 132f882f05dSGreg Roach * 133f882f05dSGreg Roach * @return CalendarDateFactoryInterface 134f882f05dSGreg Roach */ 135*2c6f1bd5SGreg Roach public static function calendarDateFactory(CalendarDateFactoryInterface|null $factory = null): CalendarDateFactoryInterface 136f882f05dSGreg Roach { 137f882f05dSGreg Roach if ($factory instanceof CalendarDateFactoryInterface) { 138f882f05dSGreg Roach self::$calendar_date_factory = $factory; 139f882f05dSGreg Roach } 140f882f05dSGreg Roach 141f882f05dSGreg Roach return self::$calendar_date_factory; 142f882f05dSGreg Roach } 143f882f05dSGreg Roach 144f882f05dSGreg Roach /** 145d35568b4SGreg Roach * Store or retrieve a PSR-11 container. 146d35568b4SGreg Roach * 147d35568b4SGreg Roach * @param ContainerInterface|null $container 148d35568b4SGreg Roach * 149d35568b4SGreg Roach * @return ContainerInterface 150d35568b4SGreg Roach */ 151*2c6f1bd5SGreg Roach public static function container(ContainerInterface|null $container = null): ContainerInterface 152d35568b4SGreg Roach { 153d35568b4SGreg Roach if ($container instanceof ContainerInterface) { 154d35568b4SGreg Roach self::$container = $container; 155d35568b4SGreg Roach } 156d35568b4SGreg Roach 157d35568b4SGreg Roach return self::$container; 158d35568b4SGreg Roach } 159d35568b4SGreg Roach 160d35568b4SGreg Roach /** 161f882f05dSGreg Roach * Store or retrieve a factory object. 162f882f05dSGreg Roach * 163c2ed51d1SGreg Roach * @param ElementFactoryInterface|null $factory 164c2ed51d1SGreg Roach * 165c2ed51d1SGreg Roach * @return ElementFactoryInterface 166c2ed51d1SGreg Roach */ 167*2c6f1bd5SGreg Roach public static function elementFactory(ElementFactoryInterface|null $factory = null): ElementFactoryInterface 168c2ed51d1SGreg Roach { 169c2ed51d1SGreg Roach if ($factory instanceof ElementFactoryInterface) { 170c2ed51d1SGreg Roach self::$element_factory = $factory; 171c2ed51d1SGreg Roach } 172c2ed51d1SGreg Roach 173c2ed51d1SGreg Roach return self::$element_factory; 174c2ed51d1SGreg Roach } 175c2ed51d1SGreg Roach 176c2ed51d1SGreg Roach /** 177c2ed51d1SGreg Roach * Store or retrieve a factory object. 178c2ed51d1SGreg Roach * 1791c6adce8SGreg Roach * @param EncodingFactoryInterface|null $factory 1801c6adce8SGreg Roach * 1811c6adce8SGreg Roach * @return EncodingFactoryInterface 1821c6adce8SGreg Roach */ 183*2c6f1bd5SGreg Roach public static function encodingFactory(EncodingFactoryInterface|null $factory = null): EncodingFactoryInterface 1841c6adce8SGreg Roach { 1851c6adce8SGreg Roach if ($factory instanceof EncodingFactoryInterface) { 1861c6adce8SGreg Roach self::$encoding_factory = $factory; 1871c6adce8SGreg Roach } 1881c6adce8SGreg Roach 1891c6adce8SGreg Roach return self::$encoding_factory; 1901c6adce8SGreg Roach } 1911c6adce8SGreg Roach 1921c6adce8SGreg Roach /** 1931c6adce8SGreg Roach * Store or retrieve a factory object. 1941c6adce8SGreg Roach * 1956b9cb339SGreg Roach * @param FamilyFactoryInterface|null $factory 1966b9cb339SGreg Roach * 1976b9cb339SGreg Roach * @return FamilyFactoryInterface 1986b9cb339SGreg Roach */ 199*2c6f1bd5SGreg Roach public static function familyFactory(FamilyFactoryInterface|null $factory = null): FamilyFactoryInterface 2006b9cb339SGreg Roach { 2016b9cb339SGreg Roach if ($factory instanceof FamilyFactoryInterface) { 2026b9cb339SGreg Roach self::$family_factory = $factory; 2036b9cb339SGreg Roach } 2046b9cb339SGreg Roach 2056b9cb339SGreg Roach return self::$family_factory; 2066b9cb339SGreg Roach } 2076b9cb339SGreg Roach 2086b9cb339SGreg Roach /** 2096b9cb339SGreg Roach * Store or retrieve a factory object. 2106b9cb339SGreg Roach * 2116b9cb339SGreg Roach * @param FilesystemFactoryInterface|null $factory 2126b9cb339SGreg Roach * 2136b9cb339SGreg Roach * @return FilesystemFactoryInterface 2146b9cb339SGreg Roach */ 215*2c6f1bd5SGreg Roach public static function filesystem(FilesystemFactoryInterface|null $factory = null): FilesystemFactoryInterface 2166b9cb339SGreg Roach { 2176b9cb339SGreg Roach if ($factory instanceof FilesystemFactoryInterface) { 2186b9cb339SGreg Roach self::$filesystem_factory = $factory; 2196b9cb339SGreg Roach } 2206b9cb339SGreg Roach 2216b9cb339SGreg Roach return self::$filesystem_factory; 2226b9cb339SGreg Roach } 2236b9cb339SGreg Roach 2246b9cb339SGreg Roach /** 2256b9cb339SGreg Roach * Store or retrieve a factory object. 2266b9cb339SGreg Roach * 2276b9cb339SGreg Roach * @param GedcomRecordFactoryInterface|null $factory 2286b9cb339SGreg Roach * 2296b9cb339SGreg Roach * @return GedcomRecordFactoryInterface 2306b9cb339SGreg Roach */ 231*2c6f1bd5SGreg Roach public static function gedcomRecordFactory(GedcomRecordFactoryInterface|null $factory = null): GedcomRecordFactoryInterface 2326b9cb339SGreg Roach { 2336b9cb339SGreg Roach if ($factory instanceof GedcomRecordFactoryInterface) { 2346b9cb339SGreg Roach self::$gedcom_record_factory = $factory; 2356b9cb339SGreg Roach } 2366b9cb339SGreg Roach 2376b9cb339SGreg Roach return self::$gedcom_record_factory; 2386b9cb339SGreg Roach } 2396b9cb339SGreg Roach 2406b9cb339SGreg Roach /** 2416b9cb339SGreg Roach * Store or retrieve a factory object. 2426b9cb339SGreg Roach * 2436b9cb339SGreg Roach * @param HeaderFactoryInterface|null $factory 2446b9cb339SGreg Roach * 2456b9cb339SGreg Roach * @return HeaderFactoryInterface 2466b9cb339SGreg Roach */ 247*2c6f1bd5SGreg Roach public static function headerFactory(HeaderFactoryInterface|null $factory = null): HeaderFactoryInterface 2486b9cb339SGreg Roach { 2496b9cb339SGreg Roach if ($factory instanceof HeaderFactoryInterface) { 2506b9cb339SGreg Roach self::$header_factory = $factory; 2516b9cb339SGreg Roach } 2526b9cb339SGreg Roach 2536b9cb339SGreg Roach return self::$header_factory; 2546b9cb339SGreg Roach } 2556b9cb339SGreg Roach 2566b9cb339SGreg Roach /** 2576b9cb339SGreg Roach * Store or retrieve a factory object. 2586b9cb339SGreg Roach * 2592e464181SGreg Roach * @param IdFactoryInterface|null $factory 2602e464181SGreg Roach * 2612e464181SGreg Roach * @return IdFactoryInterface 2622e464181SGreg Roach */ 263*2c6f1bd5SGreg Roach public static function idFactory(IdFactoryInterface|null $factory = null): IdFactoryInterface 2642e464181SGreg Roach { 2652e464181SGreg Roach if ($factory instanceof IdFactoryInterface) { 2662e464181SGreg Roach self::$id_factory = $factory; 2672e464181SGreg Roach } 2682e464181SGreg Roach 2692e464181SGreg Roach return self::$id_factory; 2702e464181SGreg Roach } 2712e464181SGreg Roach 2722e464181SGreg Roach /** 2732e464181SGreg Roach * Store or retrieve a factory object. 2742e464181SGreg Roach * 2756b9cb339SGreg Roach * @param ImageFactoryInterface|null $factory 2766b9cb339SGreg Roach * 2776b9cb339SGreg Roach * @return ImageFactoryInterface 2786b9cb339SGreg Roach */ 279*2c6f1bd5SGreg Roach public static function imageFactory(ImageFactoryInterface|null $factory = null): ImageFactoryInterface 2806b9cb339SGreg Roach { 2816b9cb339SGreg Roach if ($factory instanceof ImageFactoryInterface) { 2826b9cb339SGreg Roach self::$image_factory = $factory; 2836b9cb339SGreg Roach } 2846b9cb339SGreg Roach 2856b9cb339SGreg Roach return self::$image_factory; 2866b9cb339SGreg Roach } 2876b9cb339SGreg Roach 2886b9cb339SGreg Roach /** 2896b9cb339SGreg Roach * Store or retrieve a factory object. 2906b9cb339SGreg Roach * 2916b9cb339SGreg Roach * @param IndividualFactoryInterface|null $factory 2926b9cb339SGreg Roach * 2936b9cb339SGreg Roach * @return IndividualFactoryInterface 2946b9cb339SGreg Roach */ 295*2c6f1bd5SGreg Roach public static function individualFactory(IndividualFactoryInterface|null $factory = null): IndividualFactoryInterface 2966b9cb339SGreg Roach { 2976b9cb339SGreg Roach if ($factory instanceof IndividualFactoryInterface) { 2986b9cb339SGreg Roach self::$individual_factory = $factory; 2996b9cb339SGreg Roach } 3006b9cb339SGreg Roach 3016b9cb339SGreg Roach return self::$individual_factory; 3026b9cb339SGreg Roach } 3036b9cb339SGreg Roach 3046b9cb339SGreg Roach /** 3056b9cb339SGreg Roach * Store or retrieve a factory object. 3066b9cb339SGreg Roach * 3076b9cb339SGreg Roach * @param LocationFactoryInterface|null $factory 3086b9cb339SGreg Roach * 3096b9cb339SGreg Roach * @return LocationFactoryInterface 3106b9cb339SGreg Roach */ 311*2c6f1bd5SGreg Roach public static function locationFactory(LocationFactoryInterface|null $factory = null): LocationFactoryInterface 3126b9cb339SGreg Roach { 3136b9cb339SGreg Roach if ($factory instanceof LocationFactoryInterface) { 3146b9cb339SGreg Roach self::$location_factory = $factory; 3156b9cb339SGreg Roach } 3166b9cb339SGreg Roach 3176b9cb339SGreg Roach return self::$location_factory; 3186b9cb339SGreg Roach } 3196b9cb339SGreg Roach 3206b9cb339SGreg Roach /** 3216b9cb339SGreg Roach * Store or retrieve a factory object. 3226b9cb339SGreg Roach * 3234d35caa7SGreg Roach * @param MarkdownFactoryInterface|null $factory 3244d35caa7SGreg Roach * 3254d35caa7SGreg Roach * @return MarkdownFactoryInterface 3264d35caa7SGreg Roach */ 327*2c6f1bd5SGreg Roach public static function markdownFactory(MarkdownFactoryInterface|null $factory = null): MarkdownFactoryInterface 3284d35caa7SGreg Roach { 3294d35caa7SGreg Roach if ($factory instanceof MarkdownFactoryInterface) { 3304d35caa7SGreg Roach self::$markdown_factory = $factory; 3314d35caa7SGreg Roach } 3324d35caa7SGreg Roach 3334d35caa7SGreg Roach return self::$markdown_factory; 3344d35caa7SGreg Roach } 3354d35caa7SGreg Roach 3364d35caa7SGreg Roach /** 3374d35caa7SGreg Roach * Store or retrieve a factory object. 3384d35caa7SGreg Roach * 3396b9cb339SGreg Roach * @param MediaFactoryInterface|null $factory 3406b9cb339SGreg Roach * 3416b9cb339SGreg Roach * @return MediaFactoryInterface 3426b9cb339SGreg Roach */ 343*2c6f1bd5SGreg Roach public static function mediaFactory(MediaFactoryInterface|null $factory = null): MediaFactoryInterface 3446b9cb339SGreg Roach { 3456b9cb339SGreg Roach if ($factory instanceof MediaFactoryInterface) { 3466b9cb339SGreg Roach self::$media_factory = $factory; 3476b9cb339SGreg Roach } 3486b9cb339SGreg Roach 3496b9cb339SGreg Roach return self::$media_factory; 3506b9cb339SGreg Roach } 3516b9cb339SGreg Roach 3526b9cb339SGreg Roach /** 3536b9cb339SGreg Roach * Store or retrieve a factory object. 3546b9cb339SGreg Roach * 3556b9cb339SGreg Roach * @param NoteFactoryInterface|null $factory 3566b9cb339SGreg Roach * 3576b9cb339SGreg Roach * @return NoteFactoryInterface 3586b9cb339SGreg Roach */ 359*2c6f1bd5SGreg Roach public static function noteFactory(NoteFactoryInterface|null $factory = null): NoteFactoryInterface 3606b9cb339SGreg Roach { 3616b9cb339SGreg Roach if ($factory instanceof NoteFactoryInterface) { 3626b9cb339SGreg Roach self::$note_factory = $factory; 3636b9cb339SGreg Roach } 3646b9cb339SGreg Roach 3656b9cb339SGreg Roach return self::$note_factory; 3666b9cb339SGreg Roach } 3676b9cb339SGreg Roach 3686b9cb339SGreg Roach /** 3696b9cb339SGreg Roach * Store or retrieve a factory object. 3706b9cb339SGreg Roach * 3716b9cb339SGreg Roach * @param RepositoryFactoryInterface|null $factory 3726b9cb339SGreg Roach * 3736b9cb339SGreg Roach * @return RepositoryFactoryInterface 3746b9cb339SGreg Roach */ 375*2c6f1bd5SGreg Roach public static function repositoryFactory(RepositoryFactoryInterface|null $factory = null): RepositoryFactoryInterface 3766b9cb339SGreg Roach { 3776b9cb339SGreg Roach if ($factory instanceof RepositoryFactoryInterface) { 3786b9cb339SGreg Roach self::$repository_factory = $factory; 3796b9cb339SGreg Roach } 3806b9cb339SGreg Roach 3816b9cb339SGreg Roach return self::$repository_factory; 3826b9cb339SGreg Roach } 3836b9cb339SGreg Roach 3846b9cb339SGreg Roach /** 3856b9cb339SGreg Roach * Store or retrieve a factory object. 3866b9cb339SGreg Roach * 387208909d8SGreg Roach * @param ResponseFactoryInterface|null $factory 388208909d8SGreg Roach * 389208909d8SGreg Roach * @return ResponseFactoryInterface 390208909d8SGreg Roach */ 391*2c6f1bd5SGreg Roach public static function responseFactory(ResponseFactoryInterface|null $factory = null): ResponseFactoryInterface 392208909d8SGreg Roach { 393208909d8SGreg Roach if ($factory instanceof ResponseFactoryInterface) { 394208909d8SGreg Roach self::$response_factory = $factory; 395208909d8SGreg Roach } 396208909d8SGreg Roach 397208909d8SGreg Roach return self::$response_factory; 398208909d8SGreg Roach } 399208909d8SGreg Roach 400208909d8SGreg Roach /** 401208909d8SGreg Roach * Store or retrieve a factory object. 402208909d8SGreg Roach * 403208909d8SGreg Roach * @param RouteFactoryInterface|null $factory 404208909d8SGreg Roach * 405208909d8SGreg Roach * @return RouteFactoryInterface 406208909d8SGreg Roach */ 407*2c6f1bd5SGreg Roach public static function routeFactory(RouteFactoryInterface|null $factory = null): RouteFactoryInterface 408208909d8SGreg Roach { 409208909d8SGreg Roach if ($factory instanceof RouteFactoryInterface) { 410208909d8SGreg Roach self::$route_factory = $factory; 411208909d8SGreg Roach } 412208909d8SGreg Roach 413208909d8SGreg Roach return self::$route_factory; 414208909d8SGreg Roach } 415208909d8SGreg Roach 416208909d8SGreg Roach /** 417208909d8SGreg Roach * Store or retrieve a factory object. 418208909d8SGreg Roach * 419701f5d18SGreg Roach * @param SharedNoteFactoryInterface|null $factory 420701f5d18SGreg Roach * 421701f5d18SGreg Roach * @return SharedNoteFactoryInterface 422701f5d18SGreg Roach */ 423*2c6f1bd5SGreg Roach public static function sharedNoteFactory(SharedNoteFactoryInterface|null $factory = null): SharedNoteFactoryInterface 424701f5d18SGreg Roach { 425701f5d18SGreg Roach if ($factory instanceof SharedNoteFactoryInterface) { 426701f5d18SGreg Roach self::$shared_note_factory = $factory; 427701f5d18SGreg Roach } 428701f5d18SGreg Roach 429701f5d18SGreg Roach return self::$shared_note_factory; 430701f5d18SGreg Roach } 431701f5d18SGreg Roach 432701f5d18SGreg Roach /** 433701f5d18SGreg Roach * Store or retrieve a factory object. 434701f5d18SGreg Roach * 435194b0938SGreg Roach * @param SlugFactoryInterface|null $factory 436194b0938SGreg Roach * 437194b0938SGreg Roach * @return SlugFactoryInterface 438194b0938SGreg Roach */ 439*2c6f1bd5SGreg Roach public static function slugFactory(SlugFactoryInterface|null $factory = null): SlugFactoryInterface 440194b0938SGreg Roach { 441194b0938SGreg Roach if ($factory instanceof SlugFactoryInterface) { 442194b0938SGreg Roach self::$slug_factory = $factory; 443194b0938SGreg Roach } 444194b0938SGreg Roach 445194b0938SGreg Roach return self::$slug_factory; 446194b0938SGreg Roach } 447194b0938SGreg Roach 448194b0938SGreg Roach /** 449194b0938SGreg Roach * Store or retrieve a factory object. 450194b0938SGreg Roach * 4516b9cb339SGreg Roach * @param SourceFactoryInterface|null $factory 4526b9cb339SGreg Roach * 4536b9cb339SGreg Roach * @return SourceFactoryInterface 4546b9cb339SGreg Roach */ 455*2c6f1bd5SGreg Roach public static function sourceFactory(SourceFactoryInterface|null $factory = null): SourceFactoryInterface 4566b9cb339SGreg Roach { 4576b9cb339SGreg Roach if ($factory instanceof SourceFactoryInterface) { 4586b9cb339SGreg Roach self::$source_factory = $factory; 4596b9cb339SGreg Roach } 4606b9cb339SGreg Roach 4616b9cb339SGreg Roach return self::$source_factory; 4626b9cb339SGreg Roach } 4636b9cb339SGreg Roach 4646b9cb339SGreg Roach /** 4656b9cb339SGreg Roach * Store or retrieve a factory object. 4666b9cb339SGreg Roach * 4676b9cb339SGreg Roach * @param SubmissionFactoryInterface|null $factory 4686b9cb339SGreg Roach * 4696b9cb339SGreg Roach * @return SubmissionFactoryInterface 4706b9cb339SGreg Roach */ 471*2c6f1bd5SGreg Roach public static function submissionFactory(SubmissionFactoryInterface|null $factory = null): SubmissionFactoryInterface 4726b9cb339SGreg Roach { 4736b9cb339SGreg Roach if ($factory instanceof SubmissionFactoryInterface) { 4746b9cb339SGreg Roach self::$submission_factory = $factory; 4756b9cb339SGreg Roach } 4766b9cb339SGreg Roach 4776b9cb339SGreg Roach return self::$submission_factory; 4786b9cb339SGreg Roach } 4796b9cb339SGreg Roach 4806b9cb339SGreg Roach /** 4816b9cb339SGreg Roach * Store or retrieve a factory object. 4826b9cb339SGreg Roach * 4836b9cb339SGreg Roach * @param SubmitterFactoryInterface|null $factory 4846b9cb339SGreg Roach * 4856b9cb339SGreg Roach * @return SubmitterFactoryInterface 4866b9cb339SGreg Roach */ 487*2c6f1bd5SGreg Roach public static function submitterFactory(SubmitterFactoryInterface|null $factory = null): SubmitterFactoryInterface 4886b9cb339SGreg Roach { 4896b9cb339SGreg Roach if ($factory instanceof SubmitterFactoryInterface) { 4906b9cb339SGreg Roach self::$submitter_factory = $factory; 4916b9cb339SGreg Roach } 4926b9cb339SGreg Roach 4936b9cb339SGreg Roach return self::$submitter_factory; 4946b9cb339SGreg Roach } 4956b9cb339SGreg Roach 4966b9cb339SGreg Roach /** 4976b9cb339SGreg Roach * Store or retrieve a factory object. 4986b9cb339SGreg Roach * 4997e128bbfSGreg Roach * @param SurnameTraditionFactoryInterface|null $factory 5007e128bbfSGreg Roach * 5017e128bbfSGreg Roach * @return SurnameTraditionFactoryInterface 5027e128bbfSGreg Roach */ 503*2c6f1bd5SGreg Roach public static function surnameTraditionFactory(SurnameTraditionFactoryInterface|null $factory = null): SurnameTraditionFactoryInterface 5047e128bbfSGreg Roach { 5057e128bbfSGreg Roach if ($factory instanceof SurnameTraditionFactoryInterface) { 5067e128bbfSGreg Roach self::$surname_tradition_factory = $factory; 5077e128bbfSGreg Roach } 5087e128bbfSGreg Roach 5097e128bbfSGreg Roach return self::$surname_tradition_factory; 5107e128bbfSGreg Roach } 5117e128bbfSGreg Roach 5127e128bbfSGreg Roach /** 5137e128bbfSGreg Roach * Store or retrieve a factory object. 5147e128bbfSGreg Roach * 515eeec557aSGreg Roach * @param TimeFactoryInterface|null $factory 516eeec557aSGreg Roach * 517eeec557aSGreg Roach * @return TimeFactoryInterface 518eeec557aSGreg Roach */ 519*2c6f1bd5SGreg Roach public static function timeFactory(TimeFactoryInterface|null $factory = null): TimeFactoryInterface 520eeec557aSGreg Roach { 521eeec557aSGreg Roach if ($factory instanceof TimeFactoryInterface) { 522eeec557aSGreg Roach self::$time_factory = $factory; 523eeec557aSGreg Roach } 524eeec557aSGreg Roach 525eeec557aSGreg Roach return self::$time_factory; 526eeec557aSGreg Roach } 527eeec557aSGreg Roach 528eeec557aSGreg Roach /** 529eeec557aSGreg Roach * Store or retrieve a factory object. 530eeec557aSGreg Roach * 531d97083feSGreg Roach * @param TimestampFactoryInterface|null $factory 532d97083feSGreg Roach * 533d97083feSGreg Roach * @return TimestampFactoryInterface 534d97083feSGreg Roach */ 535*2c6f1bd5SGreg Roach public static function timestampFactory(TimestampFactoryInterface|null $factory = null): TimestampFactoryInterface 536d97083feSGreg Roach { 537d97083feSGreg Roach if ($factory instanceof TimestampFactoryInterface) { 538d97083feSGreg Roach self::$timestamp_factory = $factory; 539d97083feSGreg Roach } 540d97083feSGreg Roach 541d97083feSGreg Roach return self::$timestamp_factory; 542d97083feSGreg Roach } 543d97083feSGreg Roach 544d97083feSGreg Roach /** 545d97083feSGreg Roach * Store or retrieve a factory object. 546d97083feSGreg Roach * 5476b9cb339SGreg Roach * @param XrefFactoryInterface|null $factory 5486b9cb339SGreg Roach * 5496b9cb339SGreg Roach * @return XrefFactoryInterface 5506b9cb339SGreg Roach */ 551*2c6f1bd5SGreg Roach public static function xrefFactory(XrefFactoryInterface|null $factory = null): XrefFactoryInterface 5526b9cb339SGreg Roach { 5536b9cb339SGreg Roach if ($factory instanceof XrefFactoryInterface) { 5546b9cb339SGreg Roach self::$xref_factory = $factory; 5556b9cb339SGreg Roach } 5566b9cb339SGreg Roach 5576b9cb339SGreg Roach return self::$xref_factory; 5586b9cb339SGreg Roach } 5596b9cb339SGreg Roach} 560