25 lines
678 B
PHP
25 lines
678 B
PHP
<?php
|
|
|
|
namespace MintyPHP\Service\Security;
|
|
|
|
use MintyPHP\Repository\Security\RateLimitRepositoryInterface;
|
|
|
|
class SecurityServicesFactory
|
|
{
|
|
private ?RateLimiterService $rateLimiterService = null;
|
|
|
|
public function __construct(
|
|
private readonly SecurityRepositoryFactory $securityRepositoryFactory
|
|
) {}
|
|
|
|
public function createRateLimitRepository(): RateLimitRepositoryInterface
|
|
{
|
|
return $this->securityRepositoryFactory->createRateLimitRepository();
|
|
}
|
|
|
|
public function createRateLimiterService(): RateLimiterService
|
|
{
|
|
return $this->rateLimiterService ??= new RateLimiterService($this->createRateLimitRepository());
|
|
}
|
|
}
|