|
6 | 6 | use Symfony\Component\HttpFoundation\Response; |
7 | 7 | use Symfony\Component\HttpKernel\DataCollector\DataCollector; |
8 | 8 |
|
9 | | -use VCR\VCRBundle\VCR\LoggedVideoRecorder; |
| 9 | +use VCR\VCRBundle\VCR\Logger; |
10 | 10 |
|
11 | 11 | class VCRDataCollector extends DataCollector |
12 | 12 | { |
13 | | - private $recorder; |
| 13 | + private $logger; |
14 | 14 |
|
15 | | - public function __construct(LoggedVideoRecorder $recorder) |
| 15 | + public function __construct(Logger $logger) |
16 | 16 | { |
17 | | - $this->recorder = $recorder; |
| 17 | + $this->logger = $logger; |
18 | 18 | } |
19 | 19 |
|
20 | 20 | public function collect(Request $request, Response $response, \Exception $exception = null) |
21 | 21 | { |
| 22 | + $requests = $this->logger->getHttpRequests(); |
| 23 | + $playbacks = $this->logger->getPlaybacks(); |
| 24 | + |
22 | 25 | $this->data = array( |
23 | | - 'logs' => $logs = $this->recorder->getLog(), |
24 | | - 'count' => count($logs), |
| 26 | + 'requests' => $requests, |
| 27 | + 'playbacks' => $playbacks, |
| 28 | + 'count' => count($requests) + count($playbacks), |
25 | 29 | ); |
26 | 30 | } |
27 | 31 |
|
28 | 32 | public function getRequestsLogs() |
29 | 33 | { |
30 | | - return $this->data['logs']; |
| 34 | + return $this->data['requests']; |
| 35 | + } |
| 36 | + |
| 37 | + public function getPlaybacks() |
| 38 | + { |
| 39 | + return $this->data['playbacks']; |
| 40 | + } |
| 41 | + |
| 42 | + public function getPlaybacksCount() |
| 43 | + { |
| 44 | + return count($this->data['playbacks']); |
31 | 45 | } |
32 | 46 |
|
33 | 47 | public function getRequestsCount() |
| 48 | + { |
| 49 | + return count($this->data['requests']); |
| 50 | + } |
| 51 | + |
| 52 | + public function getCount() |
34 | 53 | { |
35 | 54 | return $this->data['count']; |
36 | 55 | } |
|
0 commit comments