sessionId === '') { throw new RuntimeException('SESSION_REQUIRED'); } return $this->sessionId; } public function store(string $sessionId): void { $this->sessionId = $sessionId; } public function clear(): void { $this->sessionId = ''; } } function buildClient(string $sessionId, ?HttpClientInterface $http = null): ApiClient { $storage = new SuppliedSession($sessionId); $storage->get(); $config = new Config(key: '', pass: '', baseUrl: 'https://api.automapa.com/'); $http ??= new CurlHttpClient(); return new ApiClient($config, $http, new SessionManager($config, $http, $storage)); }