major update
This commit is contained in:
58
lib/Service/User/UserGatewayFactory.php
Normal file
58
lib/Service/User/UserGatewayFactory.php
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
namespace MintyPHP\Service\User;
|
||||
|
||||
use MintyPHP\Service\Access\AccessServicesFactory;
|
||||
use MintyPHP\Service\Access\PermissionGateway;
|
||||
use MintyPHP\Service\Settings\SettingGateway;
|
||||
use MintyPHP\Service\Settings\SettingServicesFactory;
|
||||
use MintyPHP\Service\Tenant\TenantScopeService;
|
||||
|
||||
class UserGatewayFactory
|
||||
{
|
||||
private ?SettingGateway $settingGateway = null;
|
||||
private ?PermissionGateway $permissionGateway = null;
|
||||
private ?UserSettingsGateway $userSettingsGateway = null;
|
||||
private ?UserScopeGateway $userScopeGateway = null;
|
||||
private ?UserDirectoryGateway $userDirectoryGateway = null;
|
||||
private ?UserPermissionGateway $userPermissionGateway = null;
|
||||
|
||||
public function __construct(
|
||||
private readonly UserRepositoryFactory $userRepositoryFactory,
|
||||
private readonly AccessServicesFactory $accessServicesFactory,
|
||||
private readonly SettingServicesFactory $settingServicesFactory,
|
||||
private readonly TenantScopeService $tenantScopeService
|
||||
) {
|
||||
}
|
||||
|
||||
public function createUserSettingsGateway(): UserSettingsGateway
|
||||
{
|
||||
return $this->userSettingsGateway ??= new UserSettingsGateway($this->createSettingGateway());
|
||||
}
|
||||
|
||||
public function createUserScopeGateway(): UserScopeGateway
|
||||
{
|
||||
return $this->userScopeGateway ??= new UserScopeGateway($this->tenantScopeService);
|
||||
}
|
||||
|
||||
public function createUserDirectoryGateway(): UserDirectoryGateway
|
||||
{
|
||||
return $this->userDirectoryGateway ??= new UserDirectoryGateway($this->userRepositoryFactory);
|
||||
}
|
||||
|
||||
public function createUserPermissionGateway(): UserPermissionGateway
|
||||
{
|
||||
return $this->userPermissionGateway ??= new UserPermissionGateway($this->createPermissionGateway());
|
||||
}
|
||||
|
||||
private function createPermissionGateway(): PermissionGateway
|
||||
{
|
||||
return $this->permissionGateway ??= $this->accessServicesFactory->createPermissionGateway();
|
||||
}
|
||||
|
||||
private function createSettingGateway(): SettingGateway
|
||||
{
|
||||
return $this->settingGateway ??= $this->settingServicesFactory->createSettingGateway();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user