Conditions | 3 |
Paths | 3 |
Total Lines | 20 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
33 | public function handleRequest(RequestInterface $request, callable $next, callable $first) |
||
34 | { |
||
35 | foreach ($this->queryParams as $name => $value) { |
||
36 | $uri = $request->getUri(); |
||
37 | $array = []; |
||
38 | parse_str($uri->getQuery(), $array); |
||
39 | |||
40 | // If query value is not found |
||
41 | if (!isset($array[$name])) { |
||
42 | $array[$name] = $value; |
||
43 | |||
44 | // Create a new request with the new URI with the added query param |
||
45 | $request = $request->withUri( |
||
46 | $uri->withQuery(http_build_query($array)) |
||
47 | ); |
||
48 | } |
||
49 | } |
||
50 | |||
51 | return $next($request); |
||
52 | } |
||
53 | } |
||
54 |