1 | <?php |
||
15 | class QueryCounter { |
||
16 | |||
17 | /** |
||
18 | * @var int |
||
19 | */ |
||
20 | protected $initial; |
||
21 | |||
22 | /** |
||
23 | * @var \Elgg\Database |
||
24 | */ |
||
25 | protected $db; |
||
26 | |||
27 | /** |
||
28 | * Constructor |
||
29 | * |
||
30 | * @param \Elgg\Database $db Elgg's database |
||
31 | */ |
||
32 | public function __construct(\Elgg\Database $db) { |
||
36 | |||
37 | /** |
||
38 | * Get the number of queries performed since the object was constructed |
||
39 | * |
||
40 | * @return int # of queries |
||
41 | */ |
||
42 | public function getDelta() { |
||
45 | |||
46 | /** |
||
47 | * Create header X-ElggQueryDelta-* with the delta |
||
48 | * |
||
49 | * @see getDelta() |
||
50 | * |
||
51 | * @param string $key Key to add to HTTP header name |
||
52 | * |
||
53 | * @return void |
||
54 | */ |
||
55 | public function setDeltaHeader($key = 'Default') { |
||
60 | |||
61 | /** |
||
62 | * Get SCRIPT element which sends the delta to console.log |
||
63 | * |
||
64 | * @see getDelta() |
||
65 | * |
||
66 | * @param string $key Key to display in console log |
||
67 | * |
||
68 | * @return string markup of SCRIPT element |
||
69 | */ |
||
70 | public function getDeltaScript($key = 'Default') { |
||
76 | } |
||
77 | |||
78 |