Global Boomarks
This commit is contained in:
39
lib/Service/Bookmark/BookmarkServicesFactory.php
Normal file
39
lib/Service/Bookmark/BookmarkServicesFactory.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace MintyPHP\Service\Bookmark;
|
||||
|
||||
use MintyPHP\Repository\User\BookmarkGroupRepository;
|
||||
use MintyPHP\Repository\User\BookmarkNavigationRepository;
|
||||
use MintyPHP\Repository\User\BookmarkRepository;
|
||||
|
||||
class BookmarkServicesFactory
|
||||
{
|
||||
private ?BookmarkService $bookmarkService = null;
|
||||
private ?BookmarkRepository $bookmarkRepository = null;
|
||||
private ?BookmarkGroupRepository $groupRepository = null;
|
||||
private ?BookmarkNavigationRepository $navigationRepository = null;
|
||||
|
||||
public function createBookmarkService(): BookmarkService
|
||||
{
|
||||
return $this->bookmarkService ??= new BookmarkService(
|
||||
$this->createBookmarkRepository(),
|
||||
$this->createBookmarkGroupRepository(),
|
||||
$this->createBookmarkNavigationRepository()
|
||||
);
|
||||
}
|
||||
|
||||
public function createBookmarkRepository(): BookmarkRepository
|
||||
{
|
||||
return $this->bookmarkRepository ??= new BookmarkRepository();
|
||||
}
|
||||
|
||||
public function createBookmarkGroupRepository(): BookmarkGroupRepository
|
||||
{
|
||||
return $this->groupRepository ??= new BookmarkGroupRepository();
|
||||
}
|
||||
|
||||
public function createBookmarkNavigationRepository(): BookmarkNavigationRepository
|
||||
{
|
||||
return $this->navigationRepository ??= new BookmarkNavigationRepository();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user