1
0
Files
breadcrumb-the-shire/lib/Service/Tenant/TenantServicesFactory.php

62 lines
1.9 KiB
PHP

<?php
namespace MintyPHP\Service\Tenant;
use MintyPHP\Repository\Org\DepartmentRepositoryInterface;
use MintyPHP\Repository\Tenant\TenantRepositoryInterface;
use MintyPHP\Repository\Tenant\UserTenantRepositoryInterface;
use MintyPHP\Service\Access\PermissionService;
class TenantServicesFactory
{
private ?TenantScopeService $tenantScopeService = null;
private ?TenantAvatarService $tenantAvatarService = null;
private ?TenantFaviconService $tenantFaviconService = null;
public function __construct(
private readonly PermissionService $permissionService,
private readonly TenantRepositoryFactory $tenantRepositoryFactory
) {
}
public function createTenantScopeService(): TenantScopeService
{
return $this->tenantScopeService ??= new TenantScopeService(
$this->createTenantRepository(),
$this->createDepartmentRepository(),
$this->createUserTenantRepository(),
$this->createPermissionService()
);
}
public function createTenantAvatarService(): TenantAvatarService
{
return $this->tenantAvatarService ??= new TenantAvatarService();
}
public function createTenantFaviconService(): TenantFaviconService
{
return $this->tenantFaviconService ??= new TenantFaviconService();
}
public function createTenantRepository(): TenantRepositoryInterface
{
return $this->tenantRepositoryFactory->createTenantRepository();
}
public function createDepartmentRepository(): DepartmentRepositoryInterface
{
return $this->tenantRepositoryFactory->createDepartmentRepository();
}
public function createUserTenantRepository(): UserTenantRepositoryInterface
{
return $this->tenantRepositoryFactory->createUserTenantRepository();
}
public function createPermissionService(): PermissionService
{
return $this->permissionService;
}
}