2026-09-14 19:26:26 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
|
|
namespace Uwil\ArcadiaApiPhpClient\Factory;
|
|
|
|
|
|
2026-09-15 12:49:19 +02:00
|
|
|
use Uwil\ArcadiaApiPhpClient\Lib\ApiConfig;
|
2026-09-16 10:30:17 +02:00
|
|
|
use Uwil\ArcadiaApiPhpClient\Mapper\BrandMapper;
|
|
|
|
|
use Uwil\ArcadiaApiPhpClient\Mapper\EmployeeMapper;
|
|
|
|
|
use Uwil\ArcadiaApiPhpClient\Mapper\IncoCompoMapper;
|
|
|
|
|
use Uwil\ArcadiaApiPhpClient\Mapper\IncoMapper;
|
|
|
|
|
use Uwil\ArcadiaApiPhpClient\Mapper\IncoShortMapper;
|
2026-09-14 19:26:26 +02:00
|
|
|
use Uwil\ArcadiaApiPhpClient\Repository\BrandApiRepository;
|
|
|
|
|
use Uwil\ArcadiaApiPhpClient\Repository\EmployeeApiRepository;
|
|
|
|
|
use Uwil\ArcadiaApiPhpClient\Repository\IncoApiRepository;
|
|
|
|
|
use Uwil\ArcadiaApiPhpClient\Repository\IncoCompoApiRepository;
|
|
|
|
|
use Uwil\ArcadiaApiPhpClient\Repository\IncoShortApiRepository;
|
2026-09-15 12:49:19 +02:00
|
|
|
use Uwil\ArcadiaApiPhpClient\Service\ApiService;
|
|
|
|
|
use Uwil\ArcadiaApiPhpClient\Service\ArcadiaApiService;
|
2026-09-14 19:26:26 +02:00
|
|
|
use Uwil\ArcadiaApiPhpClient\Service\ArcadiaBrandService;
|
|
|
|
|
use Uwil\ArcadiaApiPhpClient\Service\ArcadiaEmployeeService;
|
|
|
|
|
use Uwil\ArcadiaApiPhpClient\Service\ArcadiaIncoService;
|
|
|
|
|
use Uwil\ArcadiaApiPhpClient\Service\BrandService;
|
|
|
|
|
use Uwil\ArcadiaApiPhpClient\Service\EmployeeService;
|
|
|
|
|
use Uwil\ArcadiaApiPhpClient\Service\IncoService;
|
|
|
|
|
use Uwil\ArcadiaKiotaOpenApiClient\ApiClient;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @internal
|
|
|
|
|
*/
|
|
|
|
|
final class ServiceFactory
|
|
|
|
|
{
|
2026-09-15 12:49:19 +02:00
|
|
|
private ?ApiService $apiService = null;
|
|
|
|
|
|
2026-09-14 19:26:26 +02:00
|
|
|
private ?EmployeeService $employeeService = null;
|
|
|
|
|
|
|
|
|
|
private ?IncoService $incoService = null;
|
|
|
|
|
|
|
|
|
|
private ?BrandService $brandService = null;
|
|
|
|
|
|
|
|
|
|
public function __construct(
|
2026-09-15 12:49:19 +02:00
|
|
|
private readonly ApiClient $apiClient,
|
|
|
|
|
private readonly ApiConfig $apiConfig
|
2026-09-14 19:26:26 +02:00
|
|
|
) {
|
|
|
|
|
}
|
|
|
|
|
|
2026-09-15 12:49:19 +02:00
|
|
|
public function createApiService(): ApiService
|
|
|
|
|
{
|
|
|
|
|
return $this->apiService ??= new ArcadiaApiService(
|
|
|
|
|
$this->apiConfig
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2026-09-14 19:26:26 +02:00
|
|
|
public function createEmployeeService(): EmployeeService
|
|
|
|
|
{
|
|
|
|
|
return $this->employeeService ??= new ArcadiaEmployeeService(
|
|
|
|
|
new EmployeeApiRepository(
|
|
|
|
|
$this->apiClient,
|
2026-09-16 10:30:17 +02:00
|
|
|
new EmployeeMapper()
|
2026-09-14 19:26:26 +02:00
|
|
|
)
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function createIncoService(): IncoService
|
|
|
|
|
{
|
|
|
|
|
return $this->incoService ??= new ArcadiaIncoService(
|
|
|
|
|
new IncoApiRepository(
|
|
|
|
|
$this->apiClient,
|
2026-09-16 10:30:17 +02:00
|
|
|
new IncoMapper()
|
2026-09-14 19:26:26 +02:00
|
|
|
),
|
|
|
|
|
new IncoShortApiRepository(
|
|
|
|
|
$this->apiClient,
|
2026-09-16 10:30:17 +02:00
|
|
|
new IncoShortMapper()
|
2026-09-14 19:26:26 +02:00
|
|
|
),
|
|
|
|
|
new IncoCompoApiRepository(
|
|
|
|
|
$this->apiClient,
|
2026-09-16 10:30:17 +02:00
|
|
|
new IncoCompoMapper()
|
2026-09-14 19:26:26 +02:00
|
|
|
)
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function createBrandService(): BrandService
|
|
|
|
|
{
|
|
|
|
|
return $this->brandService ??= new ArcadiaBrandService(
|
|
|
|
|
new BrandApiRepository(
|
|
|
|
|
$this->apiClient,
|
2026-09-16 10:30:17 +02:00
|
|
|
new BrandMapper()
|
2026-09-14 19:26:26 +02:00
|
|
|
)
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function employeeService(): EmployeeService
|
|
|
|
|
{
|
|
|
|
|
return $this->createEmployeeService();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function incoService(): IncoService
|
|
|
|
|
{
|
|
|
|
|
return $this->createIncoService();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function brandService(): BrandService
|
|
|
|
|
{
|
|
|
|
|
return $this->createBrandService();
|
|
|
|
|
}
|
|
|
|
|
}
|