Conditions | 3 |
Paths | 3 |
Total Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
46 | 2 | public function handleRequest(RequestInterface $request, callable $next, callable $first): Promise |
|
47 | { |
||
48 | 2 | $name = $this->namingStrategy->name($request); |
|
49 | |||
50 | 2 | if ($response = $this->player->replay($name)) { |
|
51 | 1 | return new FulfilledPromise($response->withAddedHeader(static::HEADER_NAME, $name)); |
|
52 | } |
||
53 | |||
54 | 2 | if ($this->throw) { |
|
55 | 1 | throw new RequestException("Unable to find a response to replay request \"$name\".", $request); |
|
56 | } |
||
57 | |||
58 | 1 | return $next($request); |
|
59 | } |
||
60 | |||
73 |