1 | <?php |
||
15 | final class ReplayPlugin implements Plugin |
||
16 | { |
||
17 | const HEADER_NAME = 'X-VCR-REPLAYED'; |
||
18 | |||
19 | /** |
||
20 | * @var NamingStrategyInterface |
||
21 | */ |
||
22 | private $namingStrategy; |
||
23 | |||
24 | /** |
||
25 | * @var PlayerInterface |
||
26 | */ |
||
27 | private $player; |
||
28 | |||
29 | /** |
||
30 | * Throw an exception if not able to replay a request. |
||
31 | * |
||
32 | * @var bool |
||
33 | */ |
||
34 | private $throw; |
||
35 | |||
36 | 2 | public function __construct(NamingStrategyInterface $namingStrategy, PlayerInterface $player, bool $throw = true) |
|
42 | |||
43 | /** |
||
44 | * {@inheritdoc} |
||
45 | */ |
||
46 | 2 | public function handleRequest(RequestInterface $request, callable $next, callable $first): Promise |
|
60 | |||
61 | /** |
||
62 | * Whenever the plugin should throw an exception when not able to replay a request. |
||
63 | * |
||
64 | * @return $this |
||
65 | */ |
||
66 | 1 | public function throwOnNotFound(bool $throw) |
|
72 | } |
||
73 |