| Total Complexity | 2 |
| Total Lines | 31 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 10 | class Middleware |
||
| 11 | { |
||
| 12 | /** |
||
| 13 | * Append 'Content-Type' header to each client request. |
||
| 14 | * |
||
| 15 | * @param string $name |
||
| 16 | * @param string $value |
||
| 17 | * |
||
| 18 | * @return callable |
||
| 19 | */ |
||
| 20 | public static function header(string $name, string $value): callable |
||
| 21 | { |
||
| 22 | return \GuzzleHttp\Middleware::mapRequest(function (RequestInterface $request) use ($name, $value) { |
||
| 23 | return $request->withHeader($name, $value); |
||
| 24 | }); |
||
| 25 | } |
||
| 26 | |||
| 27 | /** |
||
| 28 | * Append query param to each client request. |
||
| 29 | * |
||
| 30 | * @param string $name |
||
| 31 | * @param string $value |
||
| 32 | * |
||
| 33 | * @return callable |
||
| 34 | */ |
||
| 35 | public static function queryParam(string $name, string $value): callable |
||
| 41 | }); |
||
| 42 | } |
||
| 44 |