1
0
Files
breadcrumb-the-shire/modules/bookmarks/lib/Module/Bookmarks/BookmarksContainerRegistrar.php
fs 8f6c9951c1 refactor(bookmarks): remove factory chain, interfaces, and duplicated sort logic
Remove BookmarkRepositoryFactory, BookmarkServicesFactory, and all 3
repository interfaces — single-consumer abstractions with no
polymorphism. Simplify container registrar to wire directly. Extract
duplicated updateSortOrders() (60 identical lines in two repos) into
SortOrderTrait. Consolidate icon labels from template into
BookmarkService::allowedGroupIconLabels() single source of truth.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-26 12:10:05 +01:00

27 lines
1.2 KiB
PHP

<?php
namespace MintyPHP\Module\Bookmarks;
use MintyPHP\App\AppContainer;
use MintyPHP\App\Container\ContainerRegistrar;
use MintyPHP\Module\Bookmarks\Repository\BookmarkGroupRepository;
use MintyPHP\Module\Bookmarks\Repository\BookmarkNavigationRepository;
use MintyPHP\Module\Bookmarks\Repository\BookmarkRepository;
use MintyPHP\Module\Bookmarks\Service\BookmarkService;
final class BookmarksContainerRegistrar implements ContainerRegistrar
{
public function register(AppContainer $container): void
{
$container->set(BookmarkRepository::class, static fn (): BookmarkRepository => new BookmarkRepository());
$container->set(BookmarkGroupRepository::class, static fn (): BookmarkGroupRepository => new BookmarkGroupRepository());
$container->set(BookmarkNavigationRepository::class, static fn (): BookmarkNavigationRepository => new BookmarkNavigationRepository());
$container->set(BookmarkService::class, static fn (AppContainer $c): BookmarkService => new BookmarkService(
$c->get(BookmarkRepository::class),
$c->get(BookmarkGroupRepository::class),
$c->get(BookmarkNavigationRepository::class)
));
}
}