1 | <?php |
||
21 | final class KvkClientFactory |
||
22 | { |
||
23 | 2 | public static function create(string $userKey, MapperInterface $endpoint): KvkClient |
|
30 | |||
31 | 2 | private static function createHttpClient(string $userKey, MapperInterface $endpoint): ClientInterface |
|
32 | { |
||
33 | 2 | $stack = HandlerStack::create(); |
|
34 | 2 | $stack->unshift(Middleware::mapRequest(function (RequestInterface $request) use ($userKey) { |
|
35 | return $request->withUri(Uri::withQueryValue($request->getUri(), 'user_key', $userKey)); |
||
36 | 2 | })); |
|
37 | |||
38 | 2 | return new GuzzleClient( |
|
39 | 2 | new \GuzzleHttp\Client(['handler' => $stack]), |
|
40 | 2 | $endpoint |
|
41 | ); |
||
42 | } |
||
43 | |||
44 | 2 | private static function createProfileResponseFactory(): KvkPaginatorFactory |
|
54 | } |
||
55 |