Conditions | 3 |
Paths | 4 |
Total Lines | 26 |
Code Lines | 17 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php declare(strict_types = 1); |
||
22 | public function __invoke(RequestInterface $request, array $options = []) |
||
23 | { |
||
24 | $requestId = Uuid::uuid4()->toString(); |
||
25 | if (isset($options['request-id'])) { |
||
26 | $requestId = $options['request-id']; |
||
27 | } |
||
28 | |||
29 | $headers = $request->getHeaders(); |
||
30 | $headers['X-Bunq-Client-Request-Id'][] = $requestId; |
||
31 | $headers['Cache-Control'][] = 'no-cache'; |
||
32 | $headers['X-Bunq-Geolocation'][] = '52.3 4.89 12 100 NL'; |
||
33 | $headers['X-Bunq-Language'][] = 'en_US'; |
||
34 | $headers['X-Bunq-Region'][] = 'en_US'; |
||
35 | |||
36 | // Use the session token if not overridden with installation token |
||
37 | if (!isset($headers['X-Bunq-Client-Authentication'])) { |
||
38 | $headers['X-Bunq-Client-Authentication'] = $this->sessionToken; |
||
39 | } |
||
40 | |||
41 | return new Request( |
||
42 | $request->getMethod(), |
||
43 | $request->getUri(), |
||
44 | $headers, |
||
45 | $request->getBody() |
||
46 | ); |
||
47 | } |
||
48 | } |
||
49 |