tenantScopeService ??= new TenantScopeService( $this->createTenantRepository(), $this->createDepartmentRepository(), $this->createUserTenantRepository(), $this->createPermissionGateway() ); } public function createTenantAvatarService(): TenantAvatarService { return $this->tenantAvatarService ??= new TenantAvatarService(); } public function createTenantFaviconService(): TenantFaviconService { return $this->tenantFaviconService ??= new TenantFaviconService(); } public function createTenantRepository(): TenantRepository { return $this->tenantRepository ??= new TenantRepository(); } public function createDepartmentRepository(): DepartmentRepository { return $this->departmentRepository ??= new DepartmentRepository(); } public function createUserTenantRepository(): UserTenantRepository { return $this->userTenantRepository ??= new UserTenantRepository(); } public function createPermissionGateway(): PermissionGateway { return $this->permissionGateway ??= $this->accessServicesFactory()->createPermissionGateway(); } private function accessServicesFactory(): AccessServicesFactory { return $this->accessServicesFactory ??= new AccessServicesFactory(); } }