40 lines
1.3 KiB
PHP
40 lines
1.3 KiB
PHP
<?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();
|
|
}
|
|
}
|