1 | <?php |
||
13 | class MailjetDataCollector extends DataCollector |
||
14 | { |
||
15 | protected $client; |
||
16 | |||
17 | /** |
||
18 | * @param DekaleeClient $client |
||
19 | */ |
||
20 | public function __construct(DekaleeClient $client) |
||
21 | { |
||
22 | $this->client = $client; |
||
23 | } |
||
24 | |||
25 | /** |
||
26 | * Collects data for the given Request and Response. |
||
27 | * |
||
28 | * @param Request $request A Request instance |
||
29 | * @param Response $response A Response instance |
||
30 | * @param \Exception $exception An Exception instance |
||
31 | */ |
||
32 | public function collect(Request $request, Response $response, \Exception $exception = null) |
||
33 | { |
||
34 | $this->data = $this->client->getCalls(); |
||
35 | } |
||
36 | |||
37 | /** |
||
38 | * Returns the name of the collector. |
||
39 | * |
||
40 | * @return string The collector name |
||
41 | */ |
||
42 | public function getName() |
||
43 | { |
||
44 | return 'mailjet'; |
||
45 | } |
||
46 | |||
47 | /** |
||
48 | * @return array |
||
49 | */ |
||
50 | public function getData() |
||
51 | { |
||
52 | return $this->data; |
||
53 | } |
||
54 | |||
55 | public function getCallCount() |
||
56 | { |
||
57 | return count($this->data); |
||
58 | } |
||
59 | |||
60 | /** |
||
61 | * Reset the collector to initial state |
||
62 | */ |
||
63 | public function reset() |
||
67 | } |
||
68 |